mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 3 changesets (bug 1229615) for crashtest crashes in 0-timescale.html CLOSED TREE
Backed out changeset aa313047a6de (bug 1229615) Backed out changeset 80aa7ecf9456 (bug 1229615) Backed out changeset d7bf9994e1b0 (bug 1229615)
This commit is contained in:
parent
eff71dcef1
commit
6050aa17e4
@ -111,8 +111,10 @@ MP4Metadata::~MP4Metadata()
|
||||
}
|
||||
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
#include "mp4parse.h"
|
||||
|
||||
// Helper to test the rust parser on a data source.
|
||||
static bool try_rust(const UniquePtr<mp4parse_state, FreeMP4ParseState>& aRustState, RefPtr<Stream> aSource, int32_t* aCount)
|
||||
static bool try_rust(RefPtr<Stream> aSource)
|
||||
{
|
||||
static LazyLogModule sLog("MP4Metadata");
|
||||
int64_t length;
|
||||
@ -129,8 +131,10 @@ static bool try_rust(const UniquePtr<mp4parse_state, FreeMP4ParseState>& aRustSt
|
||||
MOZ_LOG(sLog, LogLevel::Warning, ("Error copying mp4 data"));
|
||||
return false;
|
||||
}
|
||||
*aCount = mp4parse_read(aRustState.get(), buffer.data(), bytes_read);
|
||||
MOZ_LOG(sLog, LogLevel::Info, ("rust parser found %d tracks", int(*aCount)));
|
||||
auto context = mp4parse_new();
|
||||
int32_t tracks = mp4parse_read(context, buffer.data(), bytes_read);
|
||||
mp4parse_free(context);
|
||||
MOZ_LOG(sLog, LogLevel::Info, ("rust parser found %d tracks", int(tracks)));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -140,9 +144,7 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
|
||||
{
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
// Try in rust first.
|
||||
mRustState.reset(mp4parse_new());
|
||||
int32_t rust_tracks = 0;
|
||||
bool rust_mp4parse_success = try_rust(mRustState, mSource, &rust_tracks);
|
||||
bool rust_mp4parse_success = try_rust(mSource);
|
||||
Telemetry::Accumulate(Telemetry::MEDIA_RUST_MP4PARSE_SUCCESS,
|
||||
rust_mp4parse_success);
|
||||
#endif
|
||||
@ -172,35 +174,6 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
uint32_t rust_total = 0;
|
||||
const char* rust_track_type = nullptr;
|
||||
if (rust_mp4parse_success && rust_tracks > 0) {
|
||||
for (int32_t i = 0; i < rust_tracks; ++i) {
|
||||
mp4parse_track_info track_info;
|
||||
int32_t r = mp4parse_get_track_info(mRustState.get(), i, &track_info);
|
||||
switch (aType) {
|
||||
case mozilla::TrackInfo::kAudioTrack:
|
||||
rust_track_type = "audio";
|
||||
if (r == 0 && track_info.track_type == MP4PARSE_TRACK_TYPE_AAC) {
|
||||
rust_total += 1;
|
||||
}
|
||||
break;
|
||||
case mozilla::TrackInfo::kVideoTrack:
|
||||
rust_track_type = "video";
|
||||
if (r == 0 && track_info.track_type == MP4PARSE_TRACK_TYPE_H264) {
|
||||
rust_total += 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static LazyLogModule sLog("MP4Metadata");
|
||||
MOZ_LOG(sLog, LogLevel::Info, ("%s tracks found: stagefright=%u rust=%u",
|
||||
rust_track_type, total, rust_total));
|
||||
#endif
|
||||
return total;
|
||||
}
|
||||
|
||||
|
@ -133,21 +133,15 @@ pub unsafe extern "C" fn mp4parse_get_track_info(context: *mut MediaContext, tra
|
||||
// Maybe context & track should just have a single simple is_valid() instead?
|
||||
if context.timescale.is_none() ||
|
||||
track.timescale.is_none() ||
|
||||
track.empty_duration.is_none() ||
|
||||
track.media_time.is_none() ||
|
||||
track.duration.is_none() ||
|
||||
track.track_id.is_none() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
let empty_duration = if track.empty_duration.is_some() {
|
||||
media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
|
||||
} else {
|
||||
0
|
||||
};
|
||||
(*info).media_time = if track.media_time.is_some() {
|
||||
track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let empty_duration = media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap());
|
||||
(*info).media_time = track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64;
|
||||
(*info).duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
|
||||
(*info).track_id = track.track_id.unwrap();
|
||||
|
||||
|
@ -14,10 +14,6 @@
|
||||
#include "MediaInfo.h"
|
||||
#include "MediaResource.h"
|
||||
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
#include "mp4parse.h"
|
||||
#endif
|
||||
|
||||
namespace stagefright { class MetaData; }
|
||||
|
||||
namespace mp4_demuxer
|
||||
@ -25,10 +21,6 @@ namespace mp4_demuxer
|
||||
|
||||
struct StageFrightPrivate;
|
||||
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
struct FreeMP4ParseState { void operator()(mp4parse_state* aPtr) { mp4parse_free(aPtr); } };
|
||||
#endif
|
||||
|
||||
class MP4Metadata
|
||||
{
|
||||
public:
|
||||
@ -58,10 +50,6 @@ private:
|
||||
nsAutoPtr<StageFrightPrivate> mPrivate;
|
||||
CryptoFile mCrypto;
|
||||
RefPtr<Stream> mSource;
|
||||
|
||||
#ifdef MOZ_RUST_MP4PARSE
|
||||
mutable mozilla::UniquePtr<mp4parse_state, FreeMP4ParseState> mRustState;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mp4_demuxer
|
||||
|
@ -83,9 +83,6 @@ if CONFIG['MOZ_RUST']:
|
||||
SOURCES += [
|
||||
'binding/MP4Metadata.rs',
|
||||
]
|
||||
EXPORTS += [
|
||||
'binding/include/mp4parse.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'binding/Adts.cpp',
|
||||
|
Loading…
Reference in New Issue
Block a user