diff --git a/dom/media/android/AndroidMediaReader.cpp b/dom/media/android/AndroidMediaReader.cpp index 03b7edb2f5df..50a33007e9b0 100644 --- a/dom/media/android/AndroidMediaReader.cpp +++ b/dom/media/android/AndroidMediaReader.cpp @@ -43,7 +43,7 @@ nsresult AndroidMediaReader::Init(MediaDecoderReader* aCloneDonor) nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!mPlugin) { mPlugin = GetAndroidMediaPluginHost()->CreateDecoder(mDecoder->GetResource(), mType); @@ -289,7 +289,7 @@ bool AndroidMediaReader::DecodeVideoFrame(bool &aKeyframeSkip, bool AndroidMediaReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // This is the approximate byte position in the stream. int64_t pos = mDecoder->GetResource()->Tell(); @@ -322,7 +322,7 @@ bool AndroidMediaReader::DecodeAudioData() nsRefPtr AndroidMediaReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mHasAudio && mHasVideo) { // The decoder seeks/demuxes audio and video streams separately. So if diff --git a/dom/media/apple/AppleMP3Reader.cpp b/dom/media/apple/AppleMP3Reader.cpp index 234cd3a026dc..e01d3295de29 100644 --- a/dom/media/apple/AppleMP3Reader.cpp +++ b/dom/media/apple/AppleMP3Reader.cpp @@ -280,7 +280,7 @@ AppleMP3Reader::AudioSampleCallback(UInt32 aNumBytes, bool AppleMP3Reader::DecodeAudioData() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); // Read AUDIO_READ_BYTES if we can char bytes[AUDIO_READ_BYTES]; @@ -314,7 +314,7 @@ bool AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -322,14 +322,14 @@ AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip, bool AppleMP3Reader::HasAudio() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return mStreamReady; } bool AppleMP3Reader::HasVideo() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -369,7 +369,7 @@ nsresult AppleMP3Reader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); *aTags = nullptr; @@ -495,7 +495,7 @@ AppleMP3Reader::SetupDecoder() nsRefPtr AppleMP3Reader::Seek(int64_t aTime, int64_t aEndTime) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); // Find the exact frame/packet that contains |aTime|. mCurrentAudioFrame = aTime * mAudioSampleRate / USECS_PER_S; diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index 495328994208..54c76db1cfb6 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -104,7 +104,7 @@ nsresult DirectShowReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; nsresult rv; @@ -245,7 +245,7 @@ UnsignedByteToAudioSample(uint8_t aValue) bool DirectShowReader::Finish(HRESULT aStatus) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); LOG("DirectShowReader::Finish(0x%x)", aStatus); // Notify the filter graph of end of stream. @@ -302,7 +302,7 @@ private: bool DirectShowReader::DecodeAudioData() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; SampleSink* sink = mAudioSinkFilter->GetSampleSink(); @@ -349,21 +349,21 @@ bool DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } bool DirectShowReader::HasAudio() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return true; } bool DirectShowReader::HasVideo() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -382,7 +382,7 @@ nsresult DirectShowReader::SeekInternal(int64_t aTargetUs) { HRESULT hr; - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");\ + MOZ_ASSERT(OnTaskQueue()); LOG("DirectShowReader::Seek() target=%lld", aTargetUs); diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp index 45b7dc52b7f3..f82eb0acd653 100644 --- a/dom/media/gstreamer/GStreamerReader.cpp +++ b/dom/media/gstreamer/GStreamerReader.cpp @@ -366,7 +366,7 @@ GStreamerReader::GetDataLength() nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult ret = NS_OK; /* @@ -638,7 +638,7 @@ nsresult GStreamerReader::ResetDecode() bool GStreamerReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); GstBuffer *buffer = nullptr; @@ -724,7 +724,7 @@ bool GStreamerReader::DecodeAudioData() bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); GstBuffer *buffer = nullptr; @@ -844,7 +844,7 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip, nsRefPtr GStreamerReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); gint64 seekPos = aTarget * GST_USECOND; LOG(PR_LOG_DEBUG, "%p About to seek to %" GST_TIME_FORMAT, diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index 3efe16054eb8..e0a01f20e8a9 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -165,7 +165,7 @@ nsresult OggReader::ResetDecode() nsresult OggReader::ResetDecode(bool start) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult res = NS_OK; if (NS_FAILED(MediaDecoderReader::ResetDecode())) { @@ -369,7 +369,7 @@ void OggReader::SetupMediaTracksInfo(const nsTArray& aSerials) nsresult OggReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // We read packets until all bitstreams have read all their header packets. // We record the offset of the first non-header page so that we know @@ -671,7 +671,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { bool OggReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); DebugOnly haveCodecState = mVorbisState != nullptr || mOpusState != nullptr; NS_ASSERTION(haveCodecState, "Need audio codec state to decode audio"); @@ -895,7 +895,7 @@ nsresult OggReader::DecodeTheora(ogg_packet* aPacket, int64_t aTimeThreshold) bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -941,7 +941,7 @@ bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip, bool OggReader::ReadOggPage(ogg_page* aPage) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int ret = 0; while((ret = ogg_sync_pageseek(&mOggState, aPage)) <= 0) { @@ -975,7 +975,7 @@ bool OggReader::ReadOggPage(ogg_page* aPage) ogg_packet* OggReader::NextOggPacket(OggCodecState* aCodecState) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!aCodecState || !aCodecState->mActive) { return nullptr; @@ -1018,7 +1018,7 @@ GetChecksum(ogg_page* page) int64_t OggReader::RangeStartTime(int64_t aOffset) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ENSURE_TRUE(resource != nullptr, 0); nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset); @@ -1040,8 +1040,7 @@ struct nsAutoOggSyncState { int64_t OggReader::RangeEndTime(int64_t aEndOffset) { - NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(), - "Should be on state machine or decode taks queue"); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ENSURE_TRUE(resource != nullptr, -1); @@ -1181,7 +1180,7 @@ int64_t OggReader::RangeEndTime(int64_t aStartOffset, nsresult OggReader::GetSeekRanges(nsTArray& aRanges) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); AutoPinned resource(mDecoder->GetResource()); nsTArray cached; nsresult res = resource->GetCachedRanges(cached); @@ -1221,7 +1220,7 @@ OggReader::SelectSeekRange(const nsTArray& ranges, int64_t aEndTime, bool aExact) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int64_t so = 0; int64_t eo = mDecoder->GetResource()->GetLength(); int64_t st = aStartTime; @@ -1437,7 +1436,7 @@ OggReader::Seek(int64_t aTarget, int64_t aEndTime) nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mIsChained) return NS_ERROR_FAILURE; LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); @@ -1594,7 +1593,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, const SeekRange& aRange, uint32_t aFuzz) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult res; MediaResource* resource = mDecoder->GetResource(); @@ -1966,8 +1965,7 @@ nsresult OggReader::GetBuffered(dom::TimeRanges* aBuffered) VideoData* OggReader::FindStartTime(int64_t& aOutStartTime) { - NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(), - "Should be on state machine or decode task queue"); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); // Extract the start times of the bitstreams in order to calculate // the duration. diff --git a/dom/media/omx/MediaCodecReader.cpp b/dom/media/omx/MediaCodecReader.cpp index 8af195c78da8..900eb708c040 100644 --- a/dom/media/omx/MediaCodecReader.cpp +++ b/dom/media/omx/MediaCodecReader.cpp @@ -658,7 +658,7 @@ nsresult MediaCodecReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!ReallocateResources()) { return NS_ERROR_FAILURE; @@ -1031,7 +1031,7 @@ MediaCodecReader::DecodeVideoFrameSync(int64_t aTimeThreshold) nsRefPtr MediaCodecReader::Seek(int64_t aTime, int64_t aEndTime) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); mVideoTrack.mSeekTimeUs = aTime; mAudioTrack.mSeekTimeUs = aTime; diff --git a/dom/media/omx/MediaOmxCommonReader.cpp b/dom/media/omx/MediaOmxCommonReader.cpp index 93a1ef38a6dc..103a2e98132d 100644 --- a/dom/media/omx/MediaOmxCommonReader.cpp +++ b/dom/media/omx/MediaOmxCommonReader.cpp @@ -44,7 +44,7 @@ MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder) #ifdef MOZ_AUDIO_OFFLOAD void MediaOmxCommonReader::CheckAudioOffload() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); char offloadProp[128]; property_get("audio.offload.disable", offloadProp, "0"); diff --git a/dom/media/omx/MediaOmxReader.cpp b/dom/media/omx/MediaOmxReader.cpp index e6bef2af2c88..5e85fd94163d 100644 --- a/dom/media/omx/MediaOmxReader.cpp +++ b/dom/media/omx/MediaOmxReader.cpp @@ -255,7 +255,7 @@ void MediaOmxReader::PreReadMetadata() nsresult MediaOmxReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); *aTags = nullptr; @@ -365,7 +365,7 @@ MediaOmxReader::IsMediaSeekable() bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); // Record number of frames decoded and parsed. Automatically update the @@ -509,7 +509,7 @@ void MediaOmxReader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, in bool MediaOmxReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); // This is the approximate byte position in the stream. @@ -544,7 +544,7 @@ bool MediaOmxReader::DecodeAudioData() nsRefPtr MediaOmxReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); VideoFrameContainer* container = mDecoder->GetVideoFrameContainer(); diff --git a/dom/media/raw/RawReader.cpp b/dom/media/raw/RawReader.cpp index f73d7bf1aac6..b2b874f29fb4 100644 --- a/dom/media/raw/RawReader.cpp +++ b/dom/media/raw/RawReader.cpp @@ -39,8 +39,7 @@ nsresult RawReader::ResetDecode() nsresult RawReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ASSERTION(resource, "Decoder has no media resource"); @@ -121,8 +120,7 @@ RawReader::IsMediaSeekable() bool RawReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(), - "Should be on state machine or decode task queue."); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); return false; } @@ -152,8 +150,7 @@ bool RawReader::ReadFromResource(MediaResource *aResource, uint8_t* aBuf, bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -246,8 +243,7 @@ RawReader::Seek(int64_t aTime, int64_t aEndTime) nsresult RawReader::SeekInternal(int64_t aTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource *resource = mDecoder->GetResource(); NS_ASSERTION(resource, "Decoder has no media resource"); diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index 4d385cd96322..70bafdbc1e2d 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -128,7 +128,7 @@ nsresult WaveReader::Init(MediaDecoderReader* aCloneDonor) nsresult WaveReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); bool loaded = LoadRIFFChunk(); if (!loaded) { @@ -192,7 +192,7 @@ SignedShortToAudioSample(int16_t aValue) bool WaveReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int64_t pos = GetPosition() - mWavePCMOffset; int64_t len = GetDataLength(); @@ -252,7 +252,7 @@ bool WaveReader::DecodeAudioData() bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -260,7 +260,7 @@ bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip, nsRefPtr WaveReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); if (NS_FAILED(ResetDecode())) { diff --git a/dom/media/webm/IntelWebMVideoDecoder.cpp b/dom/media/webm/IntelWebMVideoDecoder.cpp index e4c7ad5f972b..809ade334587 100644 --- a/dom/media/webm/IntelWebMVideoDecoder.cpp +++ b/dom/media/webm/IntelWebMVideoDecoder.cpp @@ -353,7 +353,7 @@ IntelWebMVideoDecoder::DecodeVideoFrame(bool& aKeyframeSkip, NS_ENSURE_SUCCESS(rv, false); } - NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(mReader->OnTaskQueue()); bool rv = Decode(); { // Report the number of "decoded" frames as the difference in the diff --git a/dom/media/webm/SoftwareWebMVideoDecoder.cpp b/dom/media/webm/SoftwareWebMVideoDecoder.cpp index b1a9ade38a37..b2a9b617a914 100644 --- a/dom/media/webm/SoftwareWebMVideoDecoder.cpp +++ b/dom/media/webm/SoftwareWebMVideoDecoder.cpp @@ -74,8 +74,7 @@ bool SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(mReader->OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 73f05e3644d3..c4e792095caf 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -329,7 +329,10 @@ void WebMReader::Cleanup() nsresult WebMReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + // We can't use OnTaskQueue() here because of the wacky initialization task + // queue that TrackBuffer uses. We should be able to fix this when we do + // bug 1148234. + MOZ_ASSERT(mDecoder->OnDecodeThread()); nestegg_io io; io.read = webm_read; @@ -583,7 +586,7 @@ bool WebMReader::InitOpusDecoder() bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int r = 0; unsigned int count = 0; @@ -931,7 +934,7 @@ nsReturnRef WebMReader::NextPacket(TrackType aTrackType) bool WebMReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsAutoRef holder(NextPacket(AUDIO)); if (!holder) { @@ -1064,7 +1067,7 @@ WebMReader::Seek(int64_t aTarget, int64_t aEndTime) nsresult WebMReader::SeekInternal(int64_t aTarget) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mVideoDecoder) { nsresult rv = mVideoDecoder->Flush(); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/media/webm/WebMReader.h b/dom/media/webm/WebMReader.h index a95b92af5692..360bd5fc2449 100644 --- a/dom/media/webm/WebMReader.h +++ b/dom/media/webm/WebMReader.h @@ -143,13 +143,13 @@ public: virtual bool HasAudio() override { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasAudio; } virtual bool HasVideo() override { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasVideo; } diff --git a/dom/media/wmf/WMFReader.cpp b/dom/media/wmf/WMFReader.cpp index fffa886603c0..d442c377884d 100644 --- a/dom/media/wmf/WMFReader.cpp +++ b/dom/media/wmf/WMFReader.cpp @@ -154,14 +154,14 @@ WMFReader::Init(MediaDecoderReader* aCloneDonor) bool WMFReader::HasAudio() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasAudio; } bool WMFReader::HasVideo() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasVideo; } @@ -507,7 +507,7 @@ nsresult WMFReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); DECODER_LOG("WMFReader::ReadMetadata()"); HRESULT hr; @@ -575,7 +575,7 @@ WMFReader::IsMediaSeekable() bool WMFReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; hr = mSourceReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM, @@ -804,7 +804,7 @@ bool WMFReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -909,7 +909,7 @@ WMFReader::SeekInternal(int64_t aTargetUs) { DECODER_LOG("WMFReader::Seek() %lld", aTargetUs); - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); #ifdef DEBUG bool canSeek = false; GetSourceReaderCanSeek(mSourceReader, canSeek);