diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 7b1f7901c06a..23f9d3bcbbb0 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -11,6 +11,7 @@ #include "AbstractMediaDecoder.h" #include "MediaInfo.h" #include "MediaData.h" +#include "MediaMetadataManager.h" #include "MediaQueue.h" #include "MediaTimer.h" #include "AudioCompactor.h" @@ -327,6 +328,10 @@ public: virtual void DisableHardwareAcceleration() {} + TimedMetadataEventSource& TimedMetadataEvent() { + return mTimedMetadataEvent; + } + protected: virtual ~MediaDecoderReader(); @@ -418,6 +423,9 @@ protected: bool mHitAudioDecodeError; bool mShutdown; + // Used to send TimedMetadata to the listener. + TimedMetadataEventProducer mTimedMetadataEvent; + private: // Promises used only for the base-class (sync->async adapter) implementation // of Request{Audio,Video}Data. diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index e7a2f44ca5f6..acc9e93ce83f 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -814,10 +814,11 @@ bool OggReader::ReadOggChain() if (chained) { SetChained(true); { - nsAutoPtr info(new MediaInfo(mInfo)); - ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); auto t = mDecodedAudioFrames * USECS_PER_S / mInfo.mAudio.mRate; - mDecoder->QueueMetadata(media::TimeUnit::FromMicroseconds(t), info, tags); + mTimedMetadataEvent.Notify( + TimedMetadata(media::TimeUnit::FromMicroseconds(t), + Move(tags), + nsAutoPtr(new MediaInfo(mInfo)))); } return true; }