зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1144519 - Switch MediaDecoderReader subclasses to use OnTaskQueue(). r=jya
This commit is contained in:
Родитель
e9a60fe021
Коммит
3c6cda710d
|
@ -43,7 +43,7 @@ nsresult AndroidMediaReader::Init(MediaDecoderReader* aCloneDonor)
|
||||||
nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
if (!mPlugin) {
|
if (!mPlugin) {
|
||||||
mPlugin = GetAndroidMediaPluginHost()->CreateDecoder(mDecoder->GetResource(), mType);
|
mPlugin = GetAndroidMediaPluginHost()->CreateDecoder(mDecoder->GetResource(), mType);
|
||||||
|
@ -289,7 +289,7 @@ bool AndroidMediaReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
|
|
||||||
bool AndroidMediaReader::DecodeAudioData()
|
bool AndroidMediaReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
// This is the approximate byte position in the stream.
|
// This is the approximate byte position in the stream.
|
||||||
int64_t pos = mDecoder->GetResource()->Tell();
|
int64_t pos = mDecoder->GetResource()->Tell();
|
||||||
|
@ -322,7 +322,7 @@ bool AndroidMediaReader::DecodeAudioData()
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
AndroidMediaReader::Seek(int64_t aTarget, int64_t aEndTime)
|
AndroidMediaReader::Seek(int64_t aTarget, int64_t aEndTime)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
if (mHasAudio && mHasVideo) {
|
if (mHasAudio && mHasVideo) {
|
||||||
// The decoder seeks/demuxes audio and video streams separately. So if
|
// The decoder seeks/demuxes audio and video streams separately. So if
|
||||||
|
|
|
@ -280,7 +280,7 @@ AppleMP3Reader::AudioSampleCallback(UInt32 aNumBytes,
|
||||||
bool
|
bool
|
||||||
AppleMP3Reader::DecodeAudioData()
|
AppleMP3Reader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
// Read AUDIO_READ_BYTES if we can
|
// Read AUDIO_READ_BYTES if we can
|
||||||
char bytes[AUDIO_READ_BYTES];
|
char bytes[AUDIO_READ_BYTES];
|
||||||
|
@ -314,7 +314,7 @@ bool
|
||||||
AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip,
|
AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,14 +322,14 @@ AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
bool
|
bool
|
||||||
AppleMP3Reader::HasAudio()
|
AppleMP3Reader::HasAudio()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return mStreamReady;
|
return mStreamReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AppleMP3Reader::HasVideo()
|
AppleMP3Reader::HasVideo()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ nsresult
|
||||||
AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
|
AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
*aTags = nullptr;
|
*aTags = nullptr;
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ AppleMP3Reader::SetupDecoder()
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
AppleMP3Reader::Seek(int64_t aTime, int64_t aEndTime)
|
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|.
|
// Find the exact frame/packet that contains |aTime|.
|
||||||
mCurrentAudioFrame = aTime * mAudioSampleRate / USECS_PER_S;
|
mCurrentAudioFrame = aTime * mAudioSampleRate / USECS_PER_S;
|
||||||
|
|
|
@ -104,7 +104,7 @@ nsresult
|
||||||
DirectShowReader::ReadMetadata(MediaInfo* aInfo,
|
DirectShowReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ UnsignedByteToAudioSample(uint8_t aValue)
|
||||||
bool
|
bool
|
||||||
DirectShowReader::Finish(HRESULT aStatus)
|
DirectShowReader::Finish(HRESULT aStatus)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
LOG("DirectShowReader::Finish(0x%x)", aStatus);
|
LOG("DirectShowReader::Finish(0x%x)", aStatus);
|
||||||
// Notify the filter graph of end of stream.
|
// Notify the filter graph of end of stream.
|
||||||
|
@ -302,7 +302,7 @@ private:
|
||||||
bool
|
bool
|
||||||
DirectShowReader::DecodeAudioData()
|
DirectShowReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
SampleSink* sink = mAudioSinkFilter->GetSampleSink();
|
SampleSink* sink = mAudioSinkFilter->GetSampleSink();
|
||||||
|
@ -349,21 +349,21 @@ bool
|
||||||
DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DirectShowReader::HasAudio()
|
DirectShowReader::HasAudio()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DirectShowReader::HasVideo()
|
DirectShowReader::HasVideo()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ nsresult
|
||||||
DirectShowReader::SeekInternal(int64_t aTargetUs)
|
DirectShowReader::SeekInternal(int64_t aTargetUs)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");\
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
LOG("DirectShowReader::Seek() target=%lld", aTargetUs);
|
LOG("DirectShowReader::Seek() target=%lld", aTargetUs);
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ GStreamerReader::GetDataLength()
|
||||||
nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
nsresult ret = NS_OK;
|
nsresult ret = NS_OK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -638,7 +638,7 @@ nsresult GStreamerReader::ResetDecode()
|
||||||
|
|
||||||
bool GStreamerReader::DecodeAudioData()
|
bool GStreamerReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
GstBuffer *buffer = nullptr;
|
GstBuffer *buffer = nullptr;
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ bool GStreamerReader::DecodeAudioData()
|
||||||
bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
|
bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
GstBuffer *buffer = nullptr;
|
GstBuffer *buffer = nullptr;
|
||||||
|
|
||||||
|
@ -844,7 +844,7 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
GStreamerReader::Seek(int64_t aTarget, int64_t aEndTime)
|
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;
|
gint64 seekPos = aTarget * GST_USECOND;
|
||||||
LOG(PR_LOG_DEBUG, "%p About to seek to %" GST_TIME_FORMAT,
|
LOG(PR_LOG_DEBUG, "%p About to seek to %" GST_TIME_FORMAT,
|
||||||
|
|
|
@ -165,7 +165,7 @@ nsresult OggReader::ResetDecode()
|
||||||
|
|
||||||
nsresult OggReader::ResetDecode(bool start)
|
nsresult OggReader::ResetDecode(bool start)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
nsresult res = NS_OK;
|
nsresult res = NS_OK;
|
||||||
|
|
||||||
if (NS_FAILED(MediaDecoderReader::ResetDecode())) {
|
if (NS_FAILED(MediaDecoderReader::ResetDecode())) {
|
||||||
|
@ -369,7 +369,7 @@ void OggReader::SetupMediaTracksInfo(const nsTArray<uint32_t>& aSerials)
|
||||||
nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
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 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
|
// 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()
|
bool OggReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
DebugOnly<bool> haveCodecState = mVorbisState != nullptr ||
|
DebugOnly<bool> haveCodecState = mVorbisState != nullptr ||
|
||||||
mOpusState != nullptr;
|
mOpusState != nullptr;
|
||||||
NS_ASSERTION(haveCodecState, "Need audio codec state to decode audio");
|
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,
|
bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
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
|
// Record number of frames decoded and parsed. Automatically update the
|
||||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||||
|
@ -941,7 +941,7 @@ bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
|
|
||||||
bool OggReader::ReadOggPage(ogg_page* aPage)
|
bool OggReader::ReadOggPage(ogg_page* aPage)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
while((ret = ogg_sync_pageseek(&mOggState, aPage)) <= 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)
|
ogg_packet* OggReader::NextOggPacket(OggCodecState* aCodecState)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
if (!aCodecState || !aCodecState->mActive) {
|
if (!aCodecState || !aCodecState->mActive) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1018,7 +1018,7 @@ GetChecksum(ogg_page* page)
|
||||||
|
|
||||||
int64_t OggReader::RangeStartTime(int64_t aOffset)
|
int64_t OggReader::RangeStartTime(int64_t aOffset)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
MediaResource* resource = mDecoder->GetResource();
|
MediaResource* resource = mDecoder->GetResource();
|
||||||
NS_ENSURE_TRUE(resource != nullptr, 0);
|
NS_ENSURE_TRUE(resource != nullptr, 0);
|
||||||
nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
||||||
|
@ -1040,8 +1040,7 @@ struct nsAutoOggSyncState {
|
||||||
|
|
||||||
int64_t OggReader::RangeEndTime(int64_t aEndOffset)
|
int64_t OggReader::RangeEndTime(int64_t aEndOffset)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue());
|
||||||
"Should be on state machine or decode taks queue");
|
|
||||||
|
|
||||||
MediaResource* resource = mDecoder->GetResource();
|
MediaResource* resource = mDecoder->GetResource();
|
||||||
NS_ENSURE_TRUE(resource != nullptr, -1);
|
NS_ENSURE_TRUE(resource != nullptr, -1);
|
||||||
|
@ -1181,7 +1180,7 @@ int64_t OggReader::RangeEndTime(int64_t aStartOffset,
|
||||||
|
|
||||||
nsresult OggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
|
nsresult OggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
AutoPinned<MediaResource> resource(mDecoder->GetResource());
|
AutoPinned<MediaResource> resource(mDecoder->GetResource());
|
||||||
nsTArray<MediaByteRange> cached;
|
nsTArray<MediaByteRange> cached;
|
||||||
nsresult res = resource->GetCachedRanges(cached);
|
nsresult res = resource->GetCachedRanges(cached);
|
||||||
|
@ -1221,7 +1220,7 @@ OggReader::SelectSeekRange(const nsTArray<SeekRange>& ranges,
|
||||||
int64_t aEndTime,
|
int64_t aEndTime,
|
||||||
bool aExact)
|
bool aExact)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
int64_t so = 0;
|
int64_t so = 0;
|
||||||
int64_t eo = mDecoder->GetResource()->GetLength();
|
int64_t eo = mDecoder->GetResource()->GetLength();
|
||||||
int64_t st = aStartTime;
|
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)
|
nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
if (mIsChained)
|
if (mIsChained)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
|
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,
|
const SeekRange& aRange,
|
||||||
uint32_t aFuzz)
|
uint32_t aFuzz)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
nsresult res;
|
nsresult res;
|
||||||
MediaResource* resource = mDecoder->GetResource();
|
MediaResource* resource = mDecoder->GetResource();
|
||||||
|
|
||||||
|
@ -1966,8 +1965,7 @@ nsresult OggReader::GetBuffered(dom::TimeRanges* aBuffered)
|
||||||
|
|
||||||
VideoData* OggReader::FindStartTime(int64_t& aOutStartTime)
|
VideoData* OggReader::FindStartTime(int64_t& aOutStartTime)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue());
|
||||||
"Should be on state machine or decode task queue");
|
|
||||||
|
|
||||||
// Extract the start times of the bitstreams in order to calculate
|
// Extract the start times of the bitstreams in order to calculate
|
||||||
// the duration.
|
// the duration.
|
||||||
|
|
|
@ -658,7 +658,7 @@ nsresult
|
||||||
MediaCodecReader::ReadMetadata(MediaInfo* aInfo,
|
MediaCodecReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
if (!ReallocateResources()) {
|
if (!ReallocateResources()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -1031,7 +1031,7 @@ MediaCodecReader::DecodeVideoFrameSync(int64_t aTimeThreshold)
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
MediaCodecReader::Seek(int64_t aTime, int64_t aEndTime)
|
MediaCodecReader::Seek(int64_t aTime, int64_t aEndTime)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
mVideoTrack.mSeekTimeUs = aTime;
|
mVideoTrack.mSeekTimeUs = aTime;
|
||||||
mAudioTrack.mSeekTimeUs = aTime;
|
mAudioTrack.mSeekTimeUs = aTime;
|
||||||
|
|
|
@ -44,7 +44,7 @@ MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder)
|
||||||
#ifdef MOZ_AUDIO_OFFLOAD
|
#ifdef MOZ_AUDIO_OFFLOAD
|
||||||
void MediaOmxCommonReader::CheckAudioOffload()
|
void MediaOmxCommonReader::CheckAudioOffload()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
char offloadProp[128];
|
char offloadProp[128];
|
||||||
property_get("audio.offload.disable", offloadProp, "0");
|
property_get("audio.offload.disable", offloadProp, "0");
|
||||||
|
|
|
@ -255,7 +255,7 @@ void MediaOmxReader::PreReadMetadata()
|
||||||
nsresult MediaOmxReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult MediaOmxReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
EnsureActive();
|
EnsureActive();
|
||||||
|
|
||||||
*aTags = nullptr;
|
*aTags = nullptr;
|
||||||
|
@ -365,7 +365,7 @@ MediaOmxReader::IsMediaSeekable()
|
||||||
bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
EnsureActive();
|
EnsureActive();
|
||||||
|
|
||||||
// Record number of frames decoded and parsed. Automatically update the
|
// 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()
|
bool MediaOmxReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
EnsureActive();
|
EnsureActive();
|
||||||
|
|
||||||
// This is the approximate byte position in the stream.
|
// This is the approximate byte position in the stream.
|
||||||
|
@ -544,7 +544,7 @@ bool MediaOmxReader::DecodeAudioData()
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
MediaOmxReader::Seek(int64_t aTarget, int64_t aEndTime)
|
MediaOmxReader::Seek(int64_t aTarget, int64_t aEndTime)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
EnsureActive();
|
EnsureActive();
|
||||||
|
|
||||||
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
|
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
|
||||||
|
|
|
@ -39,8 +39,7 @@ nsresult RawReader::ResetDecode()
|
||||||
nsresult RawReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult RawReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
"Should be on decode thread.");
|
|
||||||
|
|
||||||
MediaResource* resource = mDecoder->GetResource();
|
MediaResource* resource = mDecoder->GetResource();
|
||||||
NS_ASSERTION(resource, "Decoder has no media resource");
|
NS_ASSERTION(resource, "Decoder has no media resource");
|
||||||
|
@ -121,8 +120,7 @@ RawReader::IsMediaSeekable()
|
||||||
|
|
||||||
bool RawReader::DecodeAudioData()
|
bool RawReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnStateMachineTaskQueue() || mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue());
|
||||||
"Should be on state machine or decode task queue.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +150,7 @@ bool RawReader::ReadFromResource(MediaResource *aResource, uint8_t* aBuf,
|
||||||
bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
"Should be on decode thread.");
|
|
||||||
|
|
||||||
// Record number of frames decoded and parsed. Automatically update the
|
// Record number of frames decoded and parsed. Automatically update the
|
||||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
// 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)
|
nsresult RawReader::SeekInternal(int64_t aTime)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(),
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
"Should be on decode thread.");
|
|
||||||
|
|
||||||
MediaResource *resource = mDecoder->GetResource();
|
MediaResource *resource = mDecoder->GetResource();
|
||||||
NS_ASSERTION(resource, "Decoder has no media resource");
|
NS_ASSERTION(resource, "Decoder has no media resource");
|
||||||
|
|
|
@ -128,7 +128,7 @@ nsresult WaveReader::Init(MediaDecoderReader* aCloneDonor)
|
||||||
nsresult WaveReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult WaveReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
bool loaded = LoadRIFFChunk();
|
bool loaded = LoadRIFFChunk();
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
|
@ -192,7 +192,7 @@ SignedShortToAudioSample<int16_t>(int16_t aValue)
|
||||||
|
|
||||||
bool WaveReader::DecodeAudioData()
|
bool WaveReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
int64_t pos = GetPosition() - mWavePCMOffset;
|
int64_t pos = GetPosition() - mWavePCMOffset;
|
||||||
int64_t len = GetDataLength();
|
int64_t len = GetDataLength();
|
||||||
|
@ -252,7 +252,7 @@ bool WaveReader::DecodeAudioData()
|
||||||
bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
nsRefPtr<MediaDecoderReader::SeekPromise>
|
nsRefPtr<MediaDecoderReader::SeekPromise>
|
||||||
WaveReader::Seek(int64_t aTarget, int64_t aEndTime)
|
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));
|
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
|
||||||
|
|
||||||
if (NS_FAILED(ResetDecode())) {
|
if (NS_FAILED(ResetDecode())) {
|
||||||
|
|
|
@ -353,7 +353,7 @@ IntelWebMVideoDecoder::DecodeVideoFrame(bool& aKeyframeSkip,
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
NS_ENSURE_SUCCESS(rv, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(mReader->OnTaskQueue());
|
||||||
bool rv = Decode();
|
bool rv = Decode();
|
||||||
{
|
{
|
||||||
// Report the number of "decoded" frames as the difference in the
|
// Report the number of "decoded" frames as the difference in the
|
||||||
|
|
|
@ -74,8 +74,7 @@ bool
|
||||||
SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
int64_t aTimeThreshold)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(),
|
MOZ_ASSERT(mReader->OnTaskQueue());
|
||||||
"Should be on decode thread.");
|
|
||||||
|
|
||||||
// Record number of frames decoded and parsed. Automatically update the
|
// Record number of frames decoded and parsed. Automatically update the
|
||||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||||
|
|
|
@ -329,7 +329,10 @@ void WebMReader::Cleanup()
|
||||||
nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
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;
|
nestegg_io io;
|
||||||
io.read = webm_read;
|
io.read = webm_read;
|
||||||
|
@ -583,7 +586,7 @@ bool WebMReader::InitOpusDecoder()
|
||||||
|
|
||||||
bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
|
@ -931,7 +934,7 @@ nsReturnRef<NesteggPacketHolder> WebMReader::NextPacket(TrackType aTrackType)
|
||||||
|
|
||||||
bool WebMReader::DecodeAudioData()
|
bool WebMReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
nsAutoRef<NesteggPacketHolder> holder(NextPacket(AUDIO));
|
nsAutoRef<NesteggPacketHolder> holder(NextPacket(AUDIO));
|
||||||
if (!holder) {
|
if (!holder) {
|
||||||
|
@ -1064,7 +1067,7 @@ WebMReader::Seek(int64_t aTarget, int64_t aEndTime)
|
||||||
|
|
||||||
nsresult WebMReader::SeekInternal(int64_t aTarget)
|
nsresult WebMReader::SeekInternal(int64_t aTarget)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
if (mVideoDecoder) {
|
if (mVideoDecoder) {
|
||||||
nsresult rv = mVideoDecoder->Flush();
|
nsresult rv = mVideoDecoder->Flush();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
@ -143,13 +143,13 @@ public:
|
||||||
|
|
||||||
virtual bool HasAudio() override
|
virtual bool HasAudio() override
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return mHasAudio;
|
return mHasAudio;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool HasVideo() override
|
virtual bool HasVideo() override
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return mHasVideo;
|
return mHasVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,14 +154,14 @@ WMFReader::Init(MediaDecoderReader* aCloneDonor)
|
||||||
bool
|
bool
|
||||||
WMFReader::HasAudio()
|
WMFReader::HasAudio()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return mHasAudio;
|
return mHasAudio;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WMFReader::HasVideo()
|
WMFReader::HasVideo()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
return mHasVideo;
|
return mHasVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ nsresult
|
||||||
WMFReader::ReadMetadata(MediaInfo* aInfo,
|
WMFReader::ReadMetadata(MediaInfo* aInfo,
|
||||||
MetadataTags** aTags)
|
MetadataTags** aTags)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
DECODER_LOG("WMFReader::ReadMetadata()");
|
DECODER_LOG("WMFReader::ReadMetadata()");
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -575,7 +575,7 @@ WMFReader::IsMediaSeekable()
|
||||||
bool
|
bool
|
||||||
WMFReader::DecodeAudioData()
|
WMFReader::DecodeAudioData()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
hr = mSourceReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM,
|
hr = mSourceReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM,
|
||||||
|
@ -804,7 +804,7 @@ bool
|
||||||
WMFReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
WMFReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||||
int64_t aTimeThreshold)
|
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
|
// Record number of frames decoded and parsed. Automatically update the
|
||||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||||
|
@ -909,7 +909,7 @@ WMFReader::SeekInternal(int64_t aTargetUs)
|
||||||
{
|
{
|
||||||
DECODER_LOG("WMFReader::Seek() %lld", aTargetUs);
|
DECODER_LOG("WMFReader::Seek() %lld", aTargetUs);
|
||||||
|
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool canSeek = false;
|
bool canSeek = false;
|
||||||
GetSourceReaderCanSeek(mSourceReader, canSeek);
|
GetSourceReaderCanSeek(mSourceReader, canSeek);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче