Lines 1-4
Link Here
|
1 |
Revert bug 1284816 and bug 1341967 to postpone bustage on non-x86 archs. |
1 |
Revert bug 1284816, bug 1341967, bug 1336153 to postpone bustage on non-x86 archs. |
2 |
|
2 |
|
3 |
diff --git browser/confvars.sh browser/confvars.sh |
3 |
diff --git browser/confvars.sh browser/confvars.sh |
4 |
index d8dcd99c2757..740d9d3e5fcf 100755 |
4 |
index d8dcd99c2757..740d9d3e5fcf 100755 |
Lines 56-66
index 267d989f1597..f709820e60ae 100644
Link Here
|
56 |
if not rustc_info: |
56 |
if not rustc_info: |
57 |
die(dedent('''\ |
57 |
die(dedent('''\ |
58 |
Rust compiler not found. |
58 |
Rust compiler not found. |
|
|
59 |
@@ -97,6 +110,9 @@ def rust_compiler(rustc_info, cargo_info): |
60 |
|
61 |
return True |
62 |
|
63 |
+set_define('MOZ_RUST', rust_compiler) |
64 |
+set_config('MOZ_RUST', rust_compiler) |
65 |
+ |
66 |
@template |
67 |
def rust_triple_alias(host_or_target): |
68 |
"""Template defining the alias used for rustc's --target flag. |
69 |
@@ -227,7 +243,8 @@ set_config('RUST_HOST_TARGET', rust_host_triple) |
70 |
|
71 |
@depends(rust_target_triple) |
72 |
def rust_target_env_name(triple): |
73 |
- return triple.upper().replace('-','_') |
74 |
+ if triple: |
75 |
+ return triple.upper().replace('-','_') |
76 |
|
77 |
# We need this to form various Cargo environment variables, as there is no |
78 |
# uppercase function in make, and we don't want to shell out just for |
79 |
@@ -235,5 +252,6 @@ def rust_target_env_name(triple): |
80 |
set_config('RUST_TARGET_ENV_NAME', rust_target_env_name) |
81 |
|
82 |
# Until we remove all the other Rust checks in old-configure. |
83 |
+add_old_configure_assignment('MOZ_RUST', rust_compiler) |
84 |
add_old_configure_assignment('RUSTC', rustc) |
85 |
add_old_configure_assignment('RUST_TARGET', rust_target_triple) |
86 |
diff --git config/rules.mk config/rules.mk |
87 |
index 94cc5556e3d0..7b143ebc5146 100644 |
88 |
--- config/rules.mk |
89 |
+++ config/rules.mk |
90 |
@@ -900,6 +900,7 @@ endif |
91 |
|
92 |
$(foreach file,$(DUMP_SYMS_TARGETS),$(eval $(call syms_template,$(file),$(file)_syms.track))) |
93 |
|
94 |
+ifdef MOZ_RUST |
95 |
cargo_host_flag := --target=$(RUST_HOST_TARGET) |
96 |
cargo_target_flag := --target=$(RUST_TARGET) |
97 |
|
98 |
@@ -1055,6 +1056,7 @@ force-cargo-host-program-build: |
99 |
|
100 |
$(HOST_RUST_PROGRAMS): force-cargo-host-program-build |
101 |
endif # HOST_RUST_PROGRAMS |
102 |
+endif # MOZ_RUST |
103 |
|
104 |
$(SOBJS): |
105 |
$(REPORT_BUILD) |
59 |
diff --git dom/media/MediaPrefs.h dom/media/MediaPrefs.h |
106 |
diff --git dom/media/MediaPrefs.h dom/media/MediaPrefs.h |
60 |
index 4dcc659222a4..559334d89fd1 100644 |
107 |
index 4dcc659222a4..559334d89fd1 100644 |
61 |
--- dom/media/MediaPrefs.h |
108 |
--- dom/media/MediaPrefs.h |
62 |
+++ dom/media/MediaPrefs.h |
109 |
+++ dom/media/MediaPrefs.h |
63 |
@@ -165,7 +165,7 @@ private: |
110 |
@@ -183,7 +183,7 @@ private: |
64 |
DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false); |
111 |
DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false); |
65 |
DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true); |
112 |
DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true); |
66 |
|
113 |
|
Lines 69-74
index 4dcc659222a4..559334d89fd1 100644
Link Here
|
69 |
DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false); |
116 |
DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false); |
70 |
#endif |
117 |
#endif |
71 |
|
118 |
|
|
|
119 |
diff --git dom/media/gtest/moz.build dom/media/gtest/moz.build |
120 |
index c66ac4a9437f..e2203c0a4321 100644 |
121 |
--- dom/media/gtest/moz.build |
122 |
+++ dom/media/gtest/moz.build |
123 |
@@ -22,7 +22,6 @@ UNIFIED_SOURCES += [ |
124 |
'TestMozPromise.cpp', |
125 |
'TestMP3Demuxer.cpp', |
126 |
'TestMP4Demuxer.cpp', |
127 |
- 'TestRust.cpp', |
128 |
'TestTrackEncoder.cpp', |
129 |
'TestVideoSegment.cpp', |
130 |
'TestVideoUtils.cpp', |
131 |
@@ -36,6 +35,9 @@ if CONFIG['MOZ_WEBM_ENCODER']: |
132 |
'TestWebMWriter.cpp', |
133 |
] |
134 |
|
135 |
+if CONFIG['MOZ_RUST']: |
136 |
+ UNIFIED_SOURCES += ['TestRust.cpp',] |
137 |
+ |
138 |
TEST_HARNESS_FILES.gtest += [ |
139 |
'../test/gizmo-frag.mp4', |
140 |
'../test/gizmo.mp4', |
141 |
diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build |
142 |
index c65b53b80f63..8953f646e831 100644 |
143 |
--- media/libcubeb/src/moz.build |
144 |
+++ media/libcubeb/src/moz.build |
145 |
@@ -32,7 +32,8 @@ if CONFIG['MOZ_PULSEAUDIO']: |
146 |
'cubeb_pulse.c', |
147 |
] |
148 |
DEFINES['USE_PULSE'] = True |
149 |
- DEFINES['USE_PULSE_RUST'] = True |
150 |
+ if CONFIG['MOZ_RUST']: |
151 |
+ DEFINES['USE_PULSE_RUST'] = True |
152 |
|
153 |
if CONFIG['MOZ_JACK']: |
154 |
SOURCES += [ |
72 |
diff --git media/libstagefright/binding/DecoderData.cpp media/libstagefright/binding/DecoderData.cpp |
155 |
diff --git media/libstagefright/binding/DecoderData.cpp media/libstagefright/binding/DecoderData.cpp |
73 |
index 109ea329d154..a06e533b1e62 100644 |
156 |
index 109ea329d154..a06e533b1e62 100644 |
74 |
--- media/libstagefright/binding/DecoderData.cpp |
157 |
--- media/libstagefright/binding/DecoderData.cpp |
Lines 84-99
index 109ea329d154..a06e533b1e62 100644
Link Here
|
84 |
+#endif // MOZ_RUST_MP4PARSE |
167 |
+#endif // MOZ_RUST_MP4PARSE |
85 |
|
168 |
|
86 |
using namespace stagefright; |
169 |
using namespace stagefright; |
87 |
|
170 |
using mozilla::media::TimeUnit; |
88 |
@@ -187,6 +189,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType) |
171 |
@@ -177,6 +179,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType) |
89 |
|
172 |
FindData(aMetaData, kKeyAVCC, mExtraData); |
90 |
} |
173 |
} |
91 |
|
174 |
|
92 |
+#ifdef MOZ_RUST_MP4PARSE |
175 |
+#ifdef MOZ_RUST_MP4PARSE |
93 |
static void |
176 |
static void |
94 |
UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig, |
177 |
UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig, |
95 |
const mp4parse_sinf_info& aSinf) |
178 |
const mp4parse_sinf_info& aSinf) |
96 |
@@ -266,6 +269,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track, |
179 |
@@ -263,6 +266,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track, |
97 |
mExtraData->AppendElements(video->extra_data.data, video->extra_data.length); |
180 |
mExtraData->AppendElements(video->extra_data.data, video->extra_data.length); |
98 |
} |
181 |
} |
99 |
} |
182 |
} |
Lines 105-111
diff --git media/libstagefright/binding/MP4Metadata.cpp media/libstagefright/bin
Link Here
|
105 |
index 5c3810d99a38..5d14dfd8b8a9 100644 |
188 |
index 5c3810d99a38..5d14dfd8b8a9 100644 |
106 |
--- media/libstagefright/binding/MP4Metadata.cpp |
189 |
--- media/libstagefright/binding/MP4Metadata.cpp |
107 |
+++ media/libstagefright/binding/MP4Metadata.cpp |
190 |
+++ media/libstagefright/binding/MP4Metadata.cpp |
108 |
@@ -19,14 +19,18 @@ |
191 |
@@ -20,14 +20,18 @@ |
109 |
#include "mp4_demuxer/MP4Metadata.h" |
192 |
#include "mp4_demuxer/MP4Metadata.h" |
110 |
#include "mp4_demuxer/Stream.h" |
193 |
#include "mp4_demuxer/Stream.h" |
111 |
#include "MediaPrefs.h" |
194 |
#include "MediaPrefs.h" |
Lines 123-130
index 5c3810d99a38..5d14dfd8b8a9 100644
Link Here
|
123 |
+#endif // MOZ_RUST_MP4PARSE |
206 |
+#endif // MOZ_RUST_MP4PARSE |
124 |
|
207 |
|
125 |
using namespace stagefright; |
208 |
using namespace stagefright; |
126 |
|
209 |
using mozilla::media::TimeUnit; |
127 |
@@ -101,6 +103,7 @@ private: |
210 |
@@ -105,6 +109,7 @@ private: |
128 |
bool mCanSeek; |
211 |
bool mCanSeek; |
129 |
}; |
212 |
}; |
130 |
|
213 |
|
Lines 132-150
index 5c3810d99a38..5d14dfd8b8a9 100644
Link Here
|
132 |
// Wrap an mp4_demuxer::Stream to remember the read offset. |
215 |
// Wrap an mp4_demuxer::Stream to remember the read offset. |
133 |
|
216 |
|
134 |
class RustStreamAdaptor { |
217 |
class RustStreamAdaptor { |
135 |
@@ -145,9 +149,11 @@ private: |
218 |
@@ -151,6 +156,7 @@ private: |
136 |
RustStreamAdaptor mRustSource; |
219 |
RustStreamAdaptor mRustSource; |
137 |
mozilla::UniquePtr<mp4parse_parser, FreeMP4Parser> mRustParser; |
220 |
mozilla::UniquePtr<mp4parse_parser, FreeMP4Parser> mRustParser; |
138 |
}; |
221 |
}; |
139 |
+#endif // MOZ_RUST_MP4PARSE |
222 |
+#endif // MOZ_RUST_MP4PARSE |
140 |
|
223 |
|
|
|
224 |
class IndiceWrapperStagefright : public IndiceWrapper { |
225 |
public: |
226 |
@@ -187,6 +193,7 @@ IndiceWrapperStagefright::GetIndice(size_t aIndex, Index::Indice& aIndice) const |
227 |
return true; |
228 |
} |
229 |
|
230 |
+#ifdef MOZ_RUST_MP4PARSE |
231 |
// the owner of mIndice is rust mp4 paser, so lifetime of this class |
232 |
// SHOULD NOT longer than rust parser. |
233 |
class IndiceWrapperRust : public IndiceWrapper |
234 |
@@ -232,9 +239,11 @@ IndiceWrapperRust::GetIndice(size_t aIndex, Index::Indice& aIndice) const |
235 |
aIndice.sync = indice->sync; |
236 |
return true; |
237 |
} |
238 |
+#endif // MOZ_RUST_MP4PARSE |
239 |
|
141 |
MP4Metadata::MP4Metadata(Stream* aSource) |
240 |
MP4Metadata::MP4Metadata(Stream* aSource) |
142 |
: mStagefright(MakeUnique<MP4MetadataStagefright>(aSource)) |
241 |
: mStagefright(MakeUnique<MP4MetadataStagefright>(aSource)) |
143 |
+#ifdef MOZ_RUST_MP4PARSE |
242 |
+#ifdef MOZ_RUST_MP4PARSE |
144 |
, mRust(MakeUnique<MP4MetadataRust>(aSource)) |
243 |
, mRust(MakeUnique<MP4MetadataRust>(aSource)) |
145 |
, mPreferRust(false) |
244 |
, mPreferRust(MediaPrefs::EnableRustMP4Parser()) |
146 |
, mReportedAudioTrackTelemetry(false) |
245 |
, mReportedAudioTrackTelemetry(false) |
147 |
@@ -155,6 +161,7 @@ MP4Metadata::MP4Metadata(Stream* aSource) |
246 |
@@ -242,6 +251,7 @@ MP4Metadata::MP4Metadata(Stream* aSource) |
148 |
#ifndef RELEASE_OR_BETA |
247 |
#ifndef RELEASE_OR_BETA |
149 |
, mRustTestMode(MediaPrefs::RustTestMode()) |
248 |
, mRustTestMode(MediaPrefs::RustTestMode()) |
150 |
#endif |
249 |
#endif |
Lines 152-195
index 5c3810d99a38..5d14dfd8b8a9 100644
Link Here
|
152 |
{ |
251 |
{ |
153 |
} |
252 |
} |
154 |
|
253 |
|
155 |
@@ -186,6 +193,7 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
254 |
@@ -274,8 +284,11 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
156 |
{ |
255 |
MP4Metadata::ResultAndTrackCount numTracks = |
157 |
uint32_t numTracks = mStagefright->GetNumberTracks(aType); |
256 |
mStagefright->GetNumberTracks(aType); |
158 |
|
257 |
|
159 |
+#ifdef MOZ_RUST_MP4PARSE |
258 |
+#ifdef MOZ_RUST_MP4PARSE |
160 |
if (!mRust) { |
259 |
if (!mRust) { |
|
|
260 |
+#endif // MOZ_RUST_MP4PARSE |
161 |
return numTracks; |
261 |
return numTracks; |
|
|
262 |
+#ifdef MOZ_RUST_MP4PARSE |
162 |
} |
263 |
} |
163 |
@@ -211,10 +219,12 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
|
|
164 |
mPreferRust = true; |
165 |
return numTracksRust; |
166 |
} |
167 |
+#endif // MOZ_RUST_MP4PARSE |
168 |
|
264 |
|
169 |
return numTracks; |
265 |
MP4Metadata::ResultAndTrackCount numTracksRust = |
|
|
266 |
@@ -350,8 +363,10 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
267 |
// Same non-error numbers, just return any. |
268 |
// (Choosing Rust here, in case it carries a warning, we'd want to know that.) |
269 |
return numTracksRust; |
270 |
+#endif // MOZ_RUST_MP4PARSE |
170 |
} |
271 |
} |
171 |
|
272 |
|
172 |
+#ifdef MOZ_RUST_MP4PARSE |
273 |
+#ifdef MOZ_RUST_MP4PARSE |
173 |
bool MP4Metadata::ShouldPreferRust() const { |
274 |
bool MP4Metadata::ShouldPreferRust() const { |
174 |
if (!mRust) { |
275 |
if (!mRust) { |
175 |
return false; |
276 |
return false; |
176 |
@@ -245,6 +255,7 @@ bool MP4Metadata::ShouldPreferRust() const { |
277 |
@@ -389,6 +404,7 @@ bool MP4Metadata::ShouldPreferRust() const { |
177 |
// Otherwise, fall back. |
278 |
// Otherwise, fall back. |
178 |
return false; |
279 |
return false; |
179 |
} |
280 |
} |
180 |
+#endif // MOZ_RUST_MP4PARSE |
281 |
+#endif // MOZ_RUST_MP4PARSE |
181 |
|
282 |
|
182 |
mozilla::UniquePtr<mozilla::TrackInfo> |
283 |
static const char* |
183 |
MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
284 |
GetDifferentField(const mozilla::TrackInfo& info, |
184 |
@@ -253,6 +264,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
285 |
@@ -443,6 +459,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
185 |
mozilla::UniquePtr<mozilla::TrackInfo> info = |
286 |
MP4Metadata::ResultAndTrackInfo info = |
186 |
mStagefright->GetTrackInfo(aType, aTrackNumber); |
287 |
mStagefright->GetTrackInfo(aType, aTrackNumber); |
187 |
|
288 |
|
188 |
+#ifdef MOZ_RUST_MP4PARSE |
289 |
+#ifdef MOZ_RUST_MP4PARSE |
189 |
if (!mRust) { |
290 |
if (!mRust) { |
190 |
return info; |
291 |
return info; |
191 |
} |
292 |
} |
192 |
@@ -305,6 +317,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackTyp |
293 |
@@ -514,6 +531,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
193 |
if (mPreferRust) { |
294 |
if (mPreferRust) { |
194 |
return infoRust; |
295 |
return infoRust; |
195 |
} |
296 |
} |
Lines 197-211
index 5c3810d99a38..5d14dfd8b8a9 100644
Link Here
|
197 |
|
298 |
|
198 |
return info; |
299 |
return info; |
199 |
} |
300 |
} |
200 |
@@ -319,6 +334,7 @@ const CryptoFile& |
301 |
@@ -528,6 +546,7 @@ MP4Metadata::ResultAndCryptoFile |
201 |
MP4Metadata::Crypto() const |
302 |
MP4Metadata::Crypto() const |
202 |
{ |
303 |
{ |
203 |
const CryptoFile& crypto = mStagefright->Crypto(); |
304 |
MP4Metadata::ResultAndCryptoFile crypto = mStagefright->Crypto(); |
204 |
+#ifdef MOZ_RUST_MP4PARSE |
305 |
+#ifdef MOZ_RUST_MP4PARSE |
205 |
const CryptoFile& rustCrypto = mRust->Crypto(); |
306 |
MP4Metadata::ResultAndCryptoFile rustCrypto = mRust->Crypto(); |
206 |
|
307 |
|
207 |
#ifndef RELEASE_OR_BETA |
308 |
#ifndef RELEASE_OR_BETA |
208 |
@@ -330,6 +347,7 @@ MP4Metadata::Crypto() const |
309 |
@@ -548,6 +567,7 @@ MP4Metadata::Crypto() const |
209 |
if (mPreferRust) { |
310 |
if (mPreferRust) { |
210 |
return rustCrypto; |
311 |
return rustCrypto; |
211 |
} |
312 |
} |
Lines 213-229
index 5c3810d99a38..5d14dfd8b8a9 100644
Link Here
|
213 |
|
314 |
|
214 |
return crypto; |
315 |
return crypto; |
215 |
} |
316 |
} |
216 |
@@ -594,6 +612,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource) |
317 |
@@ -556,17 +576,22 @@ MP4Metadata::ResultAndIndice |
217 |
return parser->Metadata(); |
318 |
MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) |
|
|
319 |
{ |
320 |
FallibleTArray<Index::Indice> indiceSF; |
321 |
+#ifdef MOZ_RUST_MP4PARSE |
322 |
if (!mPreferRust |
323 |
#ifndef RELEASE_OR_BETA |
324 |
|| mRustTestMode |
325 |
#endif |
326 |
) { |
327 |
+#endif // MOZ_RUST_MP4PARSE |
328 |
MediaResult rv = mStagefright->ReadTrackIndex(indiceSF, aTrackID); |
329 |
if (NS_FAILED(rv)) { |
330 |
return {Move(rv), nullptr}; |
331 |
} |
332 |
+#ifdef MOZ_RUST_MP4PARSE |
333 |
} |
334 |
+#endif // MOZ_RUST_MP4PARSE |
335 |
|
336 |
+#ifdef MOZ_RUST_MP4PARSE |
337 |
mp4parse_byte_data indiceRust = {}; |
338 |
if (mPreferRust |
339 |
#ifndef RELEASE_OR_BETA |
340 |
@@ -592,13 +617,18 @@ MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) |
341 |
} |
342 |
} |
343 |
#endif |
344 |
+#endif // MOZ_RUST_MP4PARSE |
345 |
|
346 |
UniquePtr<IndiceWrapper> indice; |
347 |
+#ifdef MOZ_RUST_MP4PARSE |
348 |
if (mPreferRust) { |
349 |
indice = mozilla::MakeUnique<IndiceWrapperRust>(indiceRust); |
350 |
} else { |
351 |
+#endif // MOZ_RUST_MP4PARSE |
352 |
indice = mozilla::MakeUnique<IndiceWrapperStagefright>(indiceSF); |
353 |
+#ifdef MOZ_RUST_MP4PARSE |
354 |
} |
355 |
+#endif // MOZ_RUST_MP4PARSE |
356 |
|
357 |
return {NS_OK, Move(indice)}; |
358 |
} |
359 |
@@ -856,6 +886,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource) |
360 |
return {NS_OK, Move(buffer)}; |
218 |
} |
361 |
} |
219 |
|
362 |
|
220 |
+#ifdef MOZ_RUST_MP4PARSE |
363 |
+#ifdef MOZ_RUST_MP4PARSE |
221 |
bool |
364 |
bool |
222 |
RustStreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read) |
365 |
RustStreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read) |
223 |
{ |
366 |
{ |
224 |
@@ -859,5 +878,6 @@ MP4MetadataRust::Metadata(Stream* aSource) |
367 |
@@ -1152,5 +1183,6 @@ MP4MetadataRust::Metadata(Stream* aSource) |
225 |
MOZ_ASSERT(false, "Not yet implemented"); |
368 |
MOZ_ASSERT(false, "Not yet implemented"); |
226 |
return nullptr; |
369 |
return {NS_ERROR_NOT_IMPLEMENTED, nullptr}; |
227 |
} |
370 |
} |
228 |
+#endif // MOZ_RUST_MP4PARSE |
371 |
+#endif // MOZ_RUST_MP4PARSE |
229 |
|
372 |
|
Lines 272-278
diff --git media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h media/
Link Here
|
272 |
index 492c9c1c1bc3..e16dbbd1155e 100644 |
415 |
index 492c9c1c1bc3..e16dbbd1155e 100644 |
273 |
--- media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
416 |
--- media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
274 |
+++ media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
417 |
+++ media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
275 |
@@ -36,6 +36,7 @@ public: |
418 |
@@ -13,7 +13,9 @@ |
|
|
419 |
#include "MediaInfo.h" |
420 |
#include "MediaResult.h" |
421 |
#include "Stream.h" |
422 |
+#ifdef MOZ_RUST_MP4PARSE |
423 |
#include "mp4parse.h" |
424 |
+#endif // MOZ_RUST_MP4PARSE |
425 |
|
426 |
namespace mp4_demuxer { |
427 |
|
428 |
@@ -82,6 +84,7 @@ public: |
276 |
|
429 |
|
277 |
private: |
430 |
private: |
278 |
UniquePtr<MP4MetadataStagefright> mStagefright; |
431 |
UniquePtr<MP4MetadataStagefright> mStagefright; |
Lines 280-286
index 492c9c1c1bc3..e16dbbd1155e 100644
Link Here
|
280 |
UniquePtr<MP4MetadataRust> mRust; |
433 |
UniquePtr<MP4MetadataRust> mRust; |
281 |
mutable bool mPreferRust; |
434 |
mutable bool mPreferRust; |
282 |
mutable bool mReportedAudioTrackTelemetry; |
435 |
mutable bool mReportedAudioTrackTelemetry; |
283 |
@@ -44,6 +45,7 @@ private: |
436 |
@@ -90,6 +93,7 @@ private: |
284 |
mutable bool mRustTestMode; |
437 |
mutable bool mRustTestMode; |
285 |
#endif |
438 |
#endif |
286 |
bool ShouldPreferRust() const; |
439 |
bool ShouldPreferRust() const; |
Lines 288-293
index 492c9c1c1bc3..e16dbbd1155e 100644
Link Here
|
288 |
}; |
441 |
}; |
289 |
|
442 |
|
290 |
} // namespace mp4_demuxer |
443 |
} // namespace mp4_demuxer |
|
|
444 |
diff --git media/libstagefright/gtest/moz.build media/libstagefright/gtest/moz.build |
445 |
index be4d56fc93f7..66fdd365f8f3 100644 |
446 |
--- media/libstagefright/gtest/moz.build |
447 |
+++ media/libstagefright/gtest/moz.build |
448 |
@@ -38,12 +38,13 @@ TEST_HARNESS_FILES.gtest += [ |
449 |
'test_case_1351094.mp4', |
450 |
] |
451 |
|
452 |
-UNIFIED_SOURCES += ['TestMP4Rust.cpp',] |
453 |
-TEST_HARNESS_FILES.gtest += [ |
454 |
- '../../../dom/media/test/street.mp4', |
455 |
-] |
456 |
-LOCAL_INCLUDES += [ |
457 |
- '../binding/include', |
458 |
-] |
459 |
+if CONFIG['MOZ_RUST']: |
460 |
+ UNIFIED_SOURCES += ['TestMP4Rust.cpp',] |
461 |
+ TEST_HARNESS_FILES.gtest += [ |
462 |
+ '../../../dom/media/test/street.mp4', |
463 |
+ ] |
464 |
+ LOCAL_INCLUDES += [ |
465 |
+ '../binding/include', |
466 |
+ ] |
467 |
|
468 |
FINAL_LIBRARY = 'xul-gtest' |
469 |
diff --git media/libstagefright/moz.build media/libstagefright/moz.build |
470 |
index af5d1194d621..6725a0179989 100644 |
471 |
--- media/libstagefright/moz.build |
472 |
+++ media/libstagefright/moz.build |
473 |
@@ -83,9 +83,10 @@ SOURCES += [ |
474 |
'system/core/libutils/VectorImpl.cpp', |
475 |
] |
476 |
|
477 |
-EXPORTS += [ |
478 |
- 'binding/include/mp4parse.h', |
479 |
-] |
480 |
+if CONFIG['MOZ_RUST']: |
481 |
+ EXPORTS += [ |
482 |
+ 'binding/include/mp4parse.h', |
483 |
+ ] |
484 |
|
485 |
UNIFIED_SOURCES += [ |
486 |
'binding/Adts.cpp', |
291 |
diff --git mobile/android/confvars.sh mobile/android/confvars.sh |
487 |
diff --git mobile/android/confvars.sh mobile/android/confvars.sh |
292 |
index e79b6f5c0707..eb62763acaf7 100644 |
488 |
index e79b6f5c0707..eb62763acaf7 100644 |
293 |
--- mobile/android/confvars.sh |
489 |
--- mobile/android/confvars.sh |
Lines 301-321
index e79b6f5c0707..eb62763acaf7 100644
Link Here
|
301 |
# use custom widget for html:select |
497 |
# use custom widget for html:select |
302 |
MOZ_USE_NATIVE_POPUP_WINDOWS=1 |
498 |
MOZ_USE_NATIVE_POPUP_WINDOWS=1 |
303 |
|
499 |
|
|
|
500 |
diff --git netwerk/base/moz.build netwerk/base/moz.build |
501 |
index 61d022a9660e..e5ca1d77d859 100644 |
502 |
--- netwerk/base/moz.build |
503 |
+++ netwerk/base/moz.build |
504 |
@@ -256,7 +256,7 @@ UNIFIED_SOURCES += [ |
505 |
'TLSServerSocket.cpp', |
506 |
] |
507 |
|
508 |
-if CONFIG['MOZ_RUST_URLPARSE']: |
509 |
+if CONFIG['MOZ_RUST'] and CONFIG['MOZ_RUST_URLPARSE']: |
510 |
EXPORTS.mozilla.net += [ 'RustURL.h' ] |
511 |
UNIFIED_SOURCES += [ 'RustURL.cpp' ] |
512 |
|
513 |
diff --git netwerk/base/nsStandardURL.cpp netwerk/base/nsStandardURL.cpp |
514 |
index 608b918a4ecf..20bcdeb34ab8 100644 |
515 |
--- netwerk/base/nsStandardURL.cpp |
516 |
+++ netwerk/base/nsStandardURL.cpp |
517 |
@@ -858,6 +858,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) |
518 |
if (!SegmentIs(spec, mScheme, "resource") && |
519 |
!SegmentIs(spec, mScheme, "chrome")) { |
520 |
nsAutoCString ipString; |
521 |
+#ifdef MOZ_RUST |
522 |
if (encHost.Length() > 0 && |
523 |
encHost.First() == '[' && encHost.Last() == ']' && |
524 |
ValidIPv6orHostname(encHost.get(), encHost.Length())) { |
525 |
@@ -866,7 +867,9 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) |
526 |
return rv; |
527 |
} |
528 |
encHost = ipString; |
529 |
- } else if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { |
530 |
+ } else |
531 |
+#endif |
532 |
+ if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { |
533 |
encHost = ipString; |
534 |
} |
535 |
} |
536 |
@@ -2112,6 +2115,7 @@ nsStandardURL::SetHost(const nsACString &input) |
537 |
|
538 |
if (!SegmentIs(mScheme, "resource") && !SegmentIs(mScheme, "chrome")) { |
539 |
nsAutoCString ipString; |
540 |
+#ifdef MOZ_RUST |
541 |
if (hostBuf.Length() > 0 && |
542 |
hostBuf.First() == '[' && hostBuf.Last() == ']' && |
543 |
ValidIPv6orHostname(hostBuf.get(), hostBuf.Length())) { |
544 |
@@ -2120,7 +2124,9 @@ nsStandardURL::SetHost(const nsACString &input) |
545 |
return rv; |
546 |
} |
547 |
hostBuf = ipString; |
548 |
- } else if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { |
549 |
+ } else |
550 |
+#endif |
551 |
+ if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { |
552 |
hostBuf = ipString; |
553 |
} |
554 |
} |
555 |
diff --git old-configure.in old-configure.in |
556 |
index 717a94fcc692..54b29d737cc1 100644 |
557 |
--- old-configure.in |
558 |
+++ old-configure.in |
559 |
@@ -2330,9 +2330,14 @@ if test -n "$MOZ_MULET"; then |
560 |
fi |
561 |
|
562 |
# Propagate feature switches for code written in rust from confvars.sh |
563 |
-if test -n "$MOZ_RUST_URLPARSE"; then |
564 |
- AC_DEFINE(MOZ_RUST_URLPARSE) |
565 |
- AC_SUBST(MOZ_RUST_URLPARSE) |
566 |
+if test -n "$MOZ_RUST"; then |
567 |
+ if test -n "$MOZ_RUST_MP4PARSE"; then |
568 |
+ AC_DEFINE(MOZ_RUST_MP4PARSE) |
569 |
+ fi |
570 |
+ if test -n "$MOZ_RUST_URLPARSE"; then |
571 |
+ AC_DEFINE(MOZ_RUST_URLPARSE) |
572 |
+ AC_SUBST(MOZ_RUST_URLPARSE) |
573 |
+ fi |
574 |
fi |
575 |
|
576 |
AC_SUBST(MOZ_PHOENIX) |
304 |
diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json |
577 |
diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json |
305 |
index 061c55f6a5b6..e49dfd176952 100644 |
578 |
index 061c55f6a5b6..e49dfd176952 100644 |
306 |
--- toolkit/components/telemetry/Histograms.json |
579 |
--- toolkit/components/telemetry/Histograms.json |
307 |
+++ toolkit/components/telemetry/Histograms.json |
580 |
+++ toolkit/components/telemetry/Histograms.json |
308 |
@@ -6996,7 +6996,8 @@ |
581 |
@@ -8320,7 +8320,8 @@ |
309 |
"expires_in_version": "55", |
582 |
"expires_in_version": "60", |
310 |
"kind": "boolean", |
583 |
"kind": "boolean", |
311 |
"bug_numbers": [1220885], |
584 |
"bug_numbers": [1220885], |
312 |
- "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment." |
585 |
- "description": "Whether the rust mp4 demuxer successfully parsed a stream segment." |
313 |
+ "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment.", |
586 |
+ "description": "Whether the rust mp4 demuxer successfully parsed a stream segment.", |
314 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
587 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
315 |
}, |
588 |
}, |
316 |
"MEDIA_RUST_MP4PARSE_ERROR_CODE": { |
589 |
"MEDIA_RUST_MP4PARSE_ERROR_CODE": { |
317 |
"alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], |
590 |
"record_in_processes": ["main", "content"], |
318 |
@@ -7004,21 +7005,24 @@ |
591 |
@@ -8329,7 +8330,8 @@ |
319 |
"kind": "enumerated", |
592 |
"kind": "enumerated", |
320 |
"n_values": 32, |
593 |
"n_values": 32, |
321 |
"bug_numbers": [1238420], |
594 |
"bug_numbers": [1238420], |
Lines 324-331
index 061c55f6a5b6..e49dfd176952 100644
Link Here
|
324 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
597 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
325 |
}, |
598 |
}, |
326 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": { |
599 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": { |
327 |
"alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], |
600 |
"record_in_processes": ["main", "content"], |
328 |
"expires_in_version": "55", |
601 |
@@ -8337,7 +8339,8 @@ |
|
|
602 |
"expires_in_version": "60", |
329 |
"kind": "boolean", |
603 |
"kind": "boolean", |
330 |
"bug_numbers": [1231169], |
604 |
"bug_numbers": [1231169], |
331 |
- "description": "Whether rust and stagefight mp4 parser audio track results match." |
605 |
- "description": "Whether rust and stagefight mp4 parser audio track results match." |
Lines 333-340
index 061c55f6a5b6..e49dfd176952 100644
Link Here
|
333 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
607 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
334 |
}, |
608 |
}, |
335 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": { |
609 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": { |
336 |
"alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], |
610 |
"record_in_processes": ["main", "content"], |
337 |
"expires_in_version": "55", |
611 |
@@ -8345,7 +8348,8 @@ |
|
|
612 |
"expires_in_version": "60", |
338 |
"kind": "boolean", |
613 |
"kind": "boolean", |
339 |
"bug_numbers": [1231169], |
614 |
"bug_numbers": [1231169], |
340 |
- "description": "Whether rust and stagefight mp4 parser video track results match." |
615 |
- "description": "Whether rust and stagefight mp4 parser video track results match." |
Lines 342-345
index 061c55f6a5b6..e49dfd176952 100644
Link Here
|
342 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
617 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
343 |
}, |
618 |
}, |
344 |
"MEDIA_WMF_DECODE_ERROR": { |
619 |
"MEDIA_WMF_DECODE_ERROR": { |
345 |
"expires_in_version": "55", |
620 |
"record_in_processes": ["main", "content", "gpu"], |
|
|
621 |
diff --git toolkit/library/gtest/moz.build toolkit/library/gtest/moz.build |
622 |
index 69a8fb1f4893..c684f48e456e 100644 |
623 |
--- toolkit/library/gtest/moz.build |
624 |
+++ toolkit/library/gtest/moz.build |
625 |
@@ -7,7 +7,6 @@ |
626 |
FINAL_TARGET = 'dist/bin/gtest' |
627 |
|
628 |
USE_LIBS += [ |
629 |
- 'gkrust-gtest', |
630 |
'static:xul', |
631 |
# xul-gtest is an intermediate static library. It is used as FINAL_TARGET |
632 |
# for gtest code. |
633 |
@@ -21,6 +20,11 @@ USE_LIBS += [ |
634 |
# before StaticXULComponentStart. |
635 |
Libxul('xul-gtest-real') |
636 |
|
637 |
+if CONFIG['MOZ_RUST']: |
638 |
+ USE_LIBS += [ |
639 |
+ 'gkrust-gtest', |
640 |
+ ] |
641 |
+ |
642 |
DIRS += [ |
643 |
'static', |
644 |
] |
645 |
diff --git toolkit/library/moz.build toolkit/library/moz.build |
646 |
index 650f6eaba980..191e90ceb09a 100644 |
647 |
--- toolkit/library/moz.build |
648 |
+++ toolkit/library/moz.build |
649 |
@@ -63,7 +63,7 @@ def Libxul(name): |
650 |
|
651 |
# This option should go away in bug 1290972, but we need to wait until |
652 |
# Rust 1.12 has been released. |
653 |
- if CONFIG['OS_ARCH'] == 'Darwin': |
654 |
+ if CONFIG['MOZ_RUST'] and CONFIG['OS_ARCH'] == 'Darwin': |
655 |
LDFLAGS += ['-Wl,-no_compact_unwind'] |
656 |
|
657 |
Libxul('xul') |
658 |
@@ -343,4 +343,5 @@ USE_LIBS += ['StaticXULComponentsEnd'] |
659 |
# The above library needs to be last for C++ purposes. This library, |
660 |
# however, is entirely composed of Rust code, and needs to come after |
661 |
# all the C++ code so any possible C++ -> Rust calls can be resolved. |
662 |
-USE_LIBS += ['gkrust'] |
663 |
+if CONFIG['MOZ_RUST']: |
664 |
+ USE_LIBS += ['gkrust'] |
665 |
diff --git toolkit/moz.configure toolkit/moz.configure |
666 |
index ac9d123224ce..e90da70f0fa5 100644 |
667 |
--- toolkit/moz.configure |
668 |
+++ toolkit/moz.configure |
669 |
@@ -88,8 +88,7 @@ include('../js/moz.configure') |
670 |
|
671 |
# Rust |
672 |
# ============================================================== |
673 |
-include('../build/moz.configure/rust.configure', |
674 |
- when='--enable-compile-environment') |
675 |
+include('../build/moz.configure/rust.configure') |
676 |
|
677 |
|
678 |
# L10N |
679 |
@@ -623,13 +622,13 @@ id_and_secret_keyfile('Leanplum SDK') |
680 |
option('--enable-stylo', nargs='?', choices=('build',), |
681 |
help='Include Stylo in the build and/or enable it at runtime') |
682 |
|
683 |
-@depends('--enable-stylo') |
684 |
-def stylo_config(value): |
685 |
+@depends('--enable-stylo', '--enable-rust') |
686 |
+def stylo_config(value, rust_enabled): |
687 |
build_stylo = None |
688 |
enable_stylo = None |
689 |
|
690 |
# The default is to not build Stylo at all. |
691 |
- if value.origin == 'default': |
692 |
+ if not rust_enabled or value.origin == 'default': |
693 |
pass |
694 |
elif value == 'build': |
695 |
build_stylo = True |
696 |
@@ -769,12 +768,14 @@ set_config('SERVO_TARGET_DIR', servo_target_dir) |
697 |
option('--enable-webrender', nargs='?', choices=('build',), |
698 |
help='Include WebRender in the build and/or enable it at runtime') |
699 |
|
700 |
-@depends('--enable-webrender', milestone) |
701 |
-def webrender(value, milestone): |
702 |
+@depends('--enable-webrender', '--enable-rust', milestone) |
703 |
+def webrender(value, rust_enabled, milestone): |
704 |
build_webrender = None |
705 |
enable_webrender = None |
706 |
|
707 |
- if value.origin == 'default': |
708 |
+ if not rust_enabled: |
709 |
+ pass |
710 |
+ elif value.origin == 'default': |
711 |
# if nothing is specified, default to just building on Nightly |
712 |
build_webrender = milestone.is_nightly |
713 |
elif value == 'build': |
714 |
diff --git toolkit/toolkit.mozbuild toolkit/toolkit.mozbuild |
715 |
index b845aab48023..9215afc6dd2d 100644 |
716 |
--- toolkit/toolkit.mozbuild |
717 |
+++ toolkit/toolkit.mozbuild |
718 |
@@ -133,16 +133,23 @@ if CONFIG['MOZ_PREF_EXTENSIONS']: |
719 |
|
720 |
DIRS += [ |
721 |
'/devtools', |
722 |
- '/toolkit/library', |
723 |
- '/toolkit/library/gtest/rust', |
724 |
- '/toolkit/library/rust', |
725 |
- '/toolkit/library/StaticXULComponentsEnd', |
726 |
'/services', |
727 |
'/startupcache', |
728 |
'/js/ductwork/debugger', |
729 |
'/other-licenses/snappy', |
730 |
] |
731 |
|
732 |
+if CONFIG['MOZ_RUST']: |
733 |
+ DIRS += [ |
734 |
+ '/toolkit/library/gtest/rust', |
735 |
+ '/toolkit/library/rust', |
736 |
+ ] |
737 |
+ |
738 |
+DIRS += [ |
739 |
+ '/toolkit/library/StaticXULComponentsEnd', |
740 |
+ '/toolkit/library', |
741 |
+] |
742 |
+ |
743 |
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: |
744 |
DIRS += ['/toolkit/system/gnome'] |
745 |
|
746 |
diff --git toolkit/xre/nsAppRunner.cpp toolkit/xre/nsAppRunner.cpp |
747 |
index 667c2eb1b365..6fb6cf102baa 100644 |
748 |
--- toolkit/xre/nsAppRunner.cpp |
749 |
+++ toolkit/xre/nsAppRunner.cpp |
750 |
@@ -227,11 +227,13 @@ |
751 |
extern uint32_t gRestartMode; |
752 |
extern void InstallSignalHandlers(const char *ProgramName); |
753 |
|
754 |
+#ifdef MOZ_RUST |
755 |
// This workaround is fixed in Rust 1.19. For details, see bug 1358151. |
756 |
// Implementation in toolkit/library/rust/shared/lib.rs |
757 |
extern "C" { |
758 |
void rust_init_please_remove_this_after_updating_rust_1_19(); |
759 |
} |
760 |
+#endif |
761 |
|
762 |
#define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini") |
763 |
#define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches") |
764 |
@@ -3122,8 +3124,10 @@ XREMain::XRE_mainInit(bool* aExitFlag) |
765 |
return 1; |
766 |
*aExitFlag = false; |
767 |
|
768 |
+#ifdef MOZ_RUST |
769 |
// This workaround is fixed in Rust 1.19. For details, see bug 1358151. |
770 |
rust_init_please_remove_this_after_updating_rust_1_19(); |
771 |
+#endif |
772 |
|
773 |
atexit(UnexpectedExit); |
774 |
auto expectedShutdown = mozilla::MakeScopeExit([&] { |
775 |
diff --git xpcom/base/nsDebugImpl.cpp xpcom/base/nsDebugImpl.cpp |
776 |
index e6bb623c258b..c49d61dce605 100644 |
777 |
--- xpcom/base/nsDebugImpl.cpp |
778 |
+++ xpcom/base/nsDebugImpl.cpp |
779 |
@@ -148,14 +148,20 @@ nsDebugImpl::Abort(const char* aFile, int32_t aLine) |
780 |
return NS_OK; |
781 |
} |
782 |
|
783 |
+#ifdef MOZ_RUST |
784 |
// From toolkit/library/rust/lib.rs |
785 |
extern "C" void intentional_panic(const char* message); |
786 |
+#endif |
787 |
|
788 |
NS_IMETHODIMP |
789 |
nsDebugImpl::RustPanic(const char* aMessage) |
790 |
{ |
791 |
+#ifdef MOZ_RUST |
792 |
intentional_panic(aMessage); |
793 |
return NS_OK; |
794 |
+#else |
795 |
+ return NS_ERROR_NOT_IMPLEMENTED; |
796 |
+#endif |
797 |
} |
798 |
|
799 |
NS_IMETHODIMP |
800 |
diff --git xpcom/rust/nsstring/gtest/moz.build xpcom/rust/nsstring/gtest/moz.build |
801 |
index 197411678815..5bed9e57e57d 100644 |
802 |
--- xpcom/rust/nsstring/gtest/moz.build |
803 |
+++ xpcom/rust/nsstring/gtest/moz.build |
804 |
@@ -4,8 +4,9 @@ |
805 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
806 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
807 |
|
808 |
-UNIFIED_SOURCES += [ |
809 |
- 'Test.cpp' |
810 |
-] |
811 |
+if CONFIG['MOZ_RUST']: |
812 |
+ UNIFIED_SOURCES += [ |
813 |
+ 'Test.cpp' |
814 |
+ ] |
815 |
|
816 |
FINAL_LIBRARY = 'xul-gtest' |