Bug 1160695 - Track "metadata duration" separately and mirror it to MediaDecoderReader. r=jww

This commit is contained in:
Bobby Holley 2015-05-30 21:18:12 -07:00
Родитель 1893956886
Коммит f83f94efbb
25 изменённых файлов: 72 добавлений и 130 удалений

Просмотреть файл

@ -74,9 +74,6 @@ public:
// Return the duration of the media in microseconds.
virtual int64_t GetMediaDuration() = 0;
// Set the duration of the media in microseconds.
virtual void SetMediaDuration(int64_t aDuration) = 0;
// Sets the duration of the media in microseconds. The MediaDecoder
// fires a durationchange event to its owner (e.g., an HTML audio
// tag).
@ -100,9 +97,6 @@ public:
virtual void RemoveMediaTracks() = 0;
// Set the media end time in microseconds
virtual void SetMediaEndTime(int64_t aTime) = 0;
// May be called by the reader to notify this decoder that the metadata from
// the media file has been read. Call on the decode thread only.
virtual void OnReadMetadataCompleted() = 0;

Просмотреть файл

@ -1106,12 +1106,6 @@ void MediaDecoder::SetNetworkDuration(TimeUnit aNetworkDuration)
UpdatePlaybackRate();
}
void MediaDecoder::SetMediaDuration(int64_t aDuration)
{
NS_ENSURE_TRUE_VOID(GetStateMachine());
GetStateMachine()->SetDuration(aDuration);
}
void MediaDecoder::UpdateEstimatedMediaDuration(int64_t aDuration)
{
if (mPlayState <= PLAY_STATE_LOADING) {
@ -1167,12 +1161,6 @@ void MediaDecoder::SetFragmentEndTime(double aTime)
}
}
void MediaDecoder::SetMediaEndTime(int64_t aTime)
{
NS_ENSURE_TRUE_VOID(GetStateMachine());
GetStateMachine()->SetMediaEndTime(aTime);
}
void MediaDecoder::Suspend()
{
MOZ_ASSERT(NS_IsMainThread());

Просмотреть файл

@ -462,9 +462,6 @@ public:
void SetNetworkDuration(media::TimeUnit aDuration);
media::NullableTimeUnit NetworkDuration() { return mNetworkDuration; }
// Sets the initial duration of the media. Called while the media metadata
// is being read and the decode is being setup.
void SetMediaDuration(int64_t aDuration) override;
// Updates the media duration. This is called while the media is being
// played, calls before the media has reached loaded metadata are ignored.
// The duration is assumed to be an estimate, and so a degree of
@ -492,9 +489,6 @@ public:
// this point the media pauses. aTime is in seconds.
virtual void SetFragmentEndTime(double aTime);
// Set the end time of the media. aTime is in microseconds.
void SetMediaEndTime(int64_t aTime) final override;
// Invalidate the frame.
void Invalidate();
void InvalidateWithFlags(uint32_t aFlags);

Просмотреть файл

@ -1460,9 +1460,13 @@ void MediaDecoderStateMachine::RecomputeDuration()
MOZ_ASSERT(OnTaskQueue());
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
// XXXbholley - This will do something more sensible in upcoming patches. This
// would be incorrect if we ever sent spurious state mirroring updates.
if (mNetworkDuration.Ref().isSome()) {
if (mInfo.mMetadataDuration.isSome()) {
SetDuration(mInfo.mMetadataDuration.ref().ToMicroseconds());
} else if (mInfo.mMetadataEndTime.isSome() && mStartTime >= 0) {
SetDuration((mInfo.mMetadataEndTime.ref() - TimeUnit::FromMicroseconds(mStartTime)).ToMicroseconds());
} else if (mNetworkDuration.Ref().isSome()) {
// XXXbholley - This will do something more sensible in upcoming patches. This
// would be incorrect if we ever sent spurious state mirroring updates.
SetDuration(mNetworkDuration.Ref().ref().ToMicroseconds());
}
}
@ -1518,14 +1522,6 @@ void MediaDecoderStateMachine::UpdateEstimatedDuration(int64_t aDuration)
}
}
void MediaDecoderStateMachine::SetMediaEndTime(int64_t aEndTime)
{
MOZ_ASSERT(OnDecodeTaskQueue());
AssertCurrentThreadInMonitor();
mEndTime = aEndTime;
}
void MediaDecoderStateMachine::SetFragmentEndTime(int64_t aEndTime)
{
AssertCurrentThreadInMonitor();
@ -2233,6 +2229,10 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
mInfo = aMetadata->mInfo;
mMetadataTags = aMetadata->mTags.forget();
if (mInfo.mMetadataDuration.isSome() || mInfo.mMetadataEndTime.isSome()) {
RecomputeDuration();
}
if (HasVideo()) {
DECODER_LOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d",
mReader->IsAsync(),
@ -2242,7 +2242,6 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
mDecoder->StartProgressUpdates();
mGotDurationFromMetaData = (GetDuration() != -1) || mDurationSet;
if (mGotDurationFromMetaData) {
// We have all the information required: duration and size
// Inform the element that we've loaded the metadata.
@ -3239,6 +3238,8 @@ void MediaDecoderStateMachine::SetStartTime(int64_t aStartTimeUsecs)
mAudioStartTime = mStartTime;
mStreamStartTime = mStartTime;
DECODER_LOG("Set media start time to %lld", mStartTime);
RecomputeDuration();
}
void MediaDecoderStateMachine::UpdateNextFrameStatus()

Просмотреть файл

@ -206,11 +206,6 @@ public:
// A value of INT64_MAX will be treated as infinity.
void SetDuration(int64_t aDuration);
// Called while decoding metadata to set the end time of the media
// resource. The decoder monitor must be obtained before calling this.
// aEndTime is in microseconds.
void SetMediaEndTime(int64_t aEndTime);
// Called from main thread to update the duration with an estimated value.
// The duration is only changed if its significantly different than the
// the current duration, as the incoming duration is an estimate and so

Просмотреть файл

@ -24,6 +24,8 @@
#include "mozilla/CDMProxy.h"
#endif
using namespace mozilla::media;
using mozilla::layers::Image;
using mozilla::layers::LayerManager;
using mozilla::layers::LayersBackend;
@ -332,8 +334,7 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
int64_t duration = std::max(videoDuration, audioDuration);
if (duration != -1) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(duration));
}
mSeekable = mDemuxer->IsSeekable();

Просмотреть файл

@ -15,6 +15,7 @@
#include "ImageTypes.h"
#include "MediaData.h"
#include "StreamBuffer.h" // for TrackID
#include "TimeUnits.h"
namespace mozilla {
@ -348,6 +349,14 @@ public:
VideoInfo mVideo;
AudioInfo mAudio;
// If the metadata includes a duration, we store it here.
media::NullableTimeUnit mMetadataDuration;
// The Ogg reader tries to kinda-sorta compute the duration by seeking to the
// end and determining the timestamp of the last frame. This isn't useful as
// a duration until we know the start time, so we need to track it separately.
media::NullableTimeUnit mMetadataEndTime;
EncryptionInfo mCrypto;
};

Просмотреть файл

@ -18,6 +18,7 @@
namespace mozilla {
using namespace mozilla::gfx;
using namespace mozilla::media;
typedef mozilla::layers::Image Image;
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
@ -55,8 +56,7 @@ nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo,
int64_t durationUs;
mPlugin->GetDuration(mPlugin, &durationUs);
if (durationUs) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(durationUs);
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(durationUs));
}
if (mPlugin->HasVideo(mPlugin)) {

Просмотреть файл

@ -19,6 +19,8 @@
// 1152 is most memory efficient.
#define MAX_AUDIO_FRAMES 128
using namespace mozilla::media;
namespace mozilla {
extern PRLogModuleInfo* gMediaDecoderLog;
@ -413,11 +415,11 @@ AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
aInfo->mAudio.mChannels = mAudioChannels;
}
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDuration = mMP3FrameParser.GetDuration();
mDecoder->SetMediaDuration(mDuration);
}
// This special snowflake reader doesn't seem to set *aInfo = mInfo like all
// the others. Yuck.
mDuration = mMP3FrameParser.GetDuration();
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(mDuration));
aInfo->mMetadataDuration.emplace(TimeUnit::FromMicroseconds(mDuration));
return NS_OK;
}

Просмотреть файл

@ -14,6 +14,8 @@
#include "MediaResource.h"
#include "VideoUtils.h"
using namespace mozilla::media;
namespace mozilla {
@ -194,10 +196,6 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
mInfo.mAudio.mBitDepth = format.wBitsPerSample;
mBytesPerSample = format.wBitsPerSample / 8;
*aInfo = mInfo;
// Note: The SourceFilter strips ID3v2 tags out of the stream.
*aTags = nullptr;
// Begin decoding!
hr = mControl->Run();
NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
@ -207,8 +205,7 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
int64_t duration = mMP3FrameParser.GetDuration();
if (SUCCEEDED(hr)) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(duration));
}
LOG("Successfully initialized DirectShow MP3 decoder.");
@ -218,6 +215,10 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
RefTimeToUsecs(duration),
mBytesPerSample);
*aInfo = mInfo;
// Note: The SourceFilter strips ID3v2 tags out of the stream.
*aTags = nullptr;
return NS_OK;
}

Просмотреть файл

@ -32,6 +32,7 @@ using mozilla::layers::Image;
using mozilla::layers::LayerManager;
using mozilla::layers::ImageContainer;
using mozilla::layers::LayersBackend;
using mozilla::media::TimeUnit;
PRLogModuleInfo* GetDemuxerLog() {
static PRLogModuleInfo* log = nullptr;
@ -431,8 +432,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
duration = mDemuxer->Duration();
}
if (duration != -1) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(duration));
}
*aInfo = mInfo;

Просмотреть файл

@ -25,6 +25,7 @@ namespace mozilla {
using namespace gfx;
using namespace layers;
using namespace media;
// Un-comment to enable logging of seek bisections.
//#define SEEK_LOGGING
@ -470,10 +471,9 @@ nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
if (isMP3 && mMP3FrameParser.IsMP3()) {
// The MP3FrameParser has reported a duration; use that over the gstreamer
// reported duration for inter-platform consistency.
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mUseParserDuration = true;
mLastParserDuration = mMP3FrameParser.GetDuration();
mDecoder->SetMediaDuration(mLastParserDuration);
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(mLastParserDuration));
} else {
LOG(LogLevel::Debug, "querying duration");
// Otherwise use the gstreamer duration.
@ -485,10 +485,9 @@ nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
&format, &duration) && format == GST_FORMAT_TIME) {
#endif
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
LOG(LogLevel::Debug, "have duration %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
duration = GST_TIME_AS_USECONDS (duration);
mDecoder->SetMediaDuration(duration);
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(duration));
}
}

Просмотреть файл

@ -1137,7 +1137,7 @@ MediaSourceReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags)
mInfo.mCrypto.AddInitData(info.mCrypto);
MSE_DEBUG("audio reader=%p duration=%lld",
mAudioSourceDecoder.get(),
mAudioSourceDecoder->GetReader()->GetDecoder()->GetMediaDuration());
mInfo.mMetadataDuration.isSome() ? mInfo.mMetadataDuration.ref().ToMicroseconds() : -1);
}
if (mVideoTrack) {
@ -1150,7 +1150,7 @@ MediaSourceReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags)
mInfo.mCrypto.AddInitData(info.mCrypto);
MSE_DEBUG("video reader=%p duration=%lld",
GetVideoReader(),
GetVideoReader()->GetDecoder()->GetMediaDuration());
mInfo.mMetadataDuration.isSome() ? mInfo.mMetadataDuration.ref().ToMicroseconds() : -1);
}
*aInfo = mInfo;

Просмотреть файл

@ -37,7 +37,6 @@ SourceBufferDecoder::SourceBufferDecoder(MediaResource* aResource,
, mParentDecoder(aParentDecoder)
, mReader(nullptr)
, mTimestampOffset(aTimestampOffset)
, mMediaDuration(-1)
, mRealMediaDuration(0)
, mTrimmedOffset(-1)
{
@ -64,12 +63,6 @@ SourceBufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
MSE_DEBUG("UNIMPLEMENTED");
}
int64_t
SourceBufferDecoder::GetMediaDuration()
{
return mMediaDuration;
}
VideoFrameContainer*
SourceBufferDecoder::GetVideoFrameContainer()
{
@ -120,12 +113,6 @@ SourceBufferDecoder::RemoveMediaTracks()
MSE_DEBUG("UNIMPLEMENTED");
}
void
SourceBufferDecoder::SetMediaEndTime(int64_t aTime)
{
MSE_DEBUG("UNIMPLEMENTED");
}
bool
SourceBufferDecoder::HasInitializationData()
{
@ -179,12 +166,6 @@ SourceBufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded,
return mParentDecoder->NotifyDecodedFrames(aParsed, aDecoded, aDropped);
}
void
SourceBufferDecoder::SetMediaDuration(int64_t aDuration)
{
mMediaDuration = aDuration;
}
void
SourceBufferDecoder::SetRealMediaDuration(int64_t aDuration)
{

Просмотреть файл

@ -36,7 +36,7 @@ public:
virtual bool IsTransportSeekable() final override;
virtual bool OnDecodeTaskQueue() const final override;
virtual bool OnStateMachineTaskQueue() const final override;
virtual int64_t GetMediaDuration() final override;
virtual int64_t GetMediaDuration() final override { MOZ_ASSERT_UNREACHABLE(""); return -1; };
virtual layers::ImageContainer* GetImageContainer() final override;
virtual MediaDecoderOwner* GetOwner() final override;
virtual SourceBufferResource* GetResource() const final override;
@ -54,8 +54,6 @@ public:
virtual void OnReadMetadataCompleted() final override;
virtual void QueueMetadata(int64_t aTime, nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags) final override;
virtual void RemoveMediaTracks() final override;
virtual void SetMediaDuration(int64_t aDuration) final override;
virtual void SetMediaEndTime(int64_t aTime) final override;
virtual void SetMediaSeekable(bool aMediaSeekable) final override;
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) final override;
virtual bool HasInitializationData() final override;
@ -150,8 +148,6 @@ private:
nsRefPtr<MediaDecoderReader> mReader;
// in microseconds
int64_t mTimestampOffset;
// mMediaDuration contains the apparent buffer duration, excluding trimmed data.
int64_t mMediaDuration;
// mRealMediaDuration contains the real buffer duration, including trimmed data.
int64_t mRealMediaDuration;
// in seconds

Просмотреть файл

@ -809,7 +809,9 @@ TrackBuffer::CompleteInitializeDecoder(SourceBufferDecoder* aDecoder)
return;
}
int64_t duration = aDecoder->GetMediaDuration();
int64_t duration = mInfo.mMetadataDuration.isSome()
? mInfo.mMetadataDuration.ref().ToMicroseconds() : -1;
if (!duration) {
// Treat a duration of 0 as infinity
duration = -1;

Просмотреть файл

@ -24,6 +24,7 @@ extern "C" {
#include "gfx2DGlue.h"
using namespace mozilla::gfx;
using namespace mozilla::media;
namespace mozilla {
@ -289,9 +290,8 @@ void OggReader::SetupTargetSkeleton(SkeletonState* aSkeletonState)
BuildSerialList(tracks);
int64_t duration = 0;
if (NS_SUCCEEDED(aSkeletonState->GetDuration(tracks, duration))) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
LOG(LogLevel::Debug, ("Got duration from Skeleton index %lld", duration));
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(duration));
}
}
}
@ -474,10 +474,8 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
MediaResource* resource = mDecoder->GetResource();
if (mDecoder->GetMediaDuration() == -1 &&
!mDecoder->IsShutdown() &&
resource->GetLength() >= 0 &&
mDecoder->IsMediaSeekable())
if (mInfo.mMetadataDuration.isNothing() && !mDecoder->IsShutdown() &&
resource->GetLength() >= 0 && mDecoder->IsMediaSeekable())
{
// We didn't get a duration from the index or a Content-Duration header.
// Seek to the end of file to find the end time.
@ -491,7 +489,7 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
endTime = RangeEndTime(length);
}
if (endTime != -1) {
mDecoder->SetMediaEndTime(endTime);
mInfo.mMetadataEndTime.emplace(TimeUnit::FromMicroseconds(endTime));
LOG(LogLevel::Debug, ("Got Ogg duration from seeking to end %lld", endTime));
}
}

Просмотреть файл

@ -42,6 +42,7 @@
using namespace android;
using namespace mozilla::layers;
using namespace mozilla::media;
namespace mozilla {
@ -712,8 +713,7 @@ MediaCodecReader::HandleResourceAllocated()
}
int64_t duration = audioDuration > videoDuration ? audioDuration : videoDuration;
if (duration >= INT64_C(0)) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(duration));
}
// Video track's frame sizes will not overflow. Activate the video track.

Просмотреть файл

@ -23,6 +23,7 @@
#define MAX_VIDEO_DECODE_SECONDS 0.1
using namespace mozilla::gfx;
using namespace mozilla::media;
using namespace android;
namespace mozilla {
@ -281,16 +282,14 @@ void MediaOmxReader::HandleResourceAllocated()
if (mLastParserDuration >= 0) {
// Prefer the parser duration if we have it.
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(mLastParserDuration);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(mLastParserDuration));
} else {
// MP3 parser failed to find a duration.
// Set the total duration (the max of the audio and video track).
int64_t durationUs;
mOmxDecoder->GetDuration(&durationUs);
if (durationUs) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(durationUs);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(durationUs));
}
}

Просмотреть файл

@ -12,6 +12,7 @@
#include "gfx2DGlue.h"
using namespace mozilla;
using namespace mozilla::media;
RawReader::RawReader(AbstractMediaDecoder* aDecoder)
: MediaDecoderReader(aDecoder),
@ -97,10 +98,8 @@ nsresult RawReader::ReadMetadata(MediaInfo* aInfo,
int64_t length = resource->GetLength();
if (length != -1) {
ReentrantMonitorAutoEnter autoMonitor(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(USECS_PER_S *
(length - sizeof(RawVideoHeader)) /
(mFrameSize * mFrameRate));
mInfo.mMetadataDuration.emplace(TimeUnit::FromSeconds((length - sizeof(RawVideoHeader)) /
(mFrameSize * mFrameRate)));
}
*aInfo = mInfo;

Просмотреть файл

@ -17,6 +17,8 @@
#include "mozilla/Endian.h"
#include <algorithm>
using namespace mozilla::media;
namespace mozilla {
// Un-comment to enable logging of seek bisections.
@ -138,15 +140,12 @@ nsresult WaveReader::ReadMetadata(MediaInfo* aInfo,
mInfo.mAudio.mRate = mSampleRate;
mInfo.mAudio.mChannels = mChannels;
mInfo.mMetadataDuration.emplace(TimeUnit::FromSeconds(BytesToTime(GetDataLength())));
*aInfo = mInfo;
*aTags = tags.forget();
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(
static_cast<int64_t>(BytesToTime(GetDataLength()) * USECS_PER_S));
return NS_OK;
}

Просмотреть файл

@ -92,12 +92,6 @@ BufferDecoder::GetMediaDuration()
return -1;
}
void
BufferDecoder::SetMediaDuration(int64_t aDuration)
{
// ignore
}
void
BufferDecoder::UpdateEstimatedMediaDuration(int64_t aDuration)
{
@ -160,12 +154,6 @@ BufferDecoder::RemoveMediaTracks()
// ignore
}
void
BufferDecoder::SetMediaEndTime(int64_t aTime)
{
// ignore
}
void
BufferDecoder::OnReadMetadataCompleted()
{

Просмотреть файл

@ -47,8 +47,6 @@ public:
virtual int64_t GetMediaDuration() final override;
virtual void SetMediaDuration(int64_t aDuration) final override;
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) final override;
virtual void SetMediaSeekable(bool aMediaSeekable) final override;
@ -69,8 +67,6 @@ public:
virtual void RemoveMediaTracks() final override;
virtual void SetMediaEndTime(int64_t aTime) final override;
virtual void OnReadMetadataCompleted() final override;
virtual MediaDecoderOwner* GetOwner() final override;

Просмотреть файл

@ -46,6 +46,7 @@ namespace mozilla {
using namespace gfx;
using namespace layers;
using namespace media;
extern PRLogModuleInfo* gMediaDecoderLog;
PRLogModuleInfo* gNesteggLog;
@ -343,8 +344,7 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
uint64_t duration = 0;
r = nestegg_duration(mContext, &duration);
if (r == 0) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration / NS_PER_USEC);
mInfo.mMetadataDuration.emplace(TimeUnit::FromNanoseconds(duration));
}
unsigned int ntracks = 0;

Просмотреть файл

@ -27,6 +27,7 @@
#include "gfx2DGlue.h"
using namespace mozilla::gfx;
using namespace mozilla::media;
using mozilla::layers::Image;
using mozilla::layers::LayerManager;
using mozilla::layers::LayersBackend;
@ -535,8 +536,7 @@ WMFReader::ReadMetadata(MediaInfo* aInfo,
int64_t duration = 0;
hr = GetSourceReaderDuration(mSourceReader, duration);
if (SUCCEEDED(hr)) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaEndTime(duration);
mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(duration));
}
*aInfo = mInfo;