Bug 1115749 - Hold the demuxer monitor in MP4Reader::Seek. r=rillian

This method invokes Seek* on mDemuxer.
This commit is contained in:
Bobby Holley 2014-12-29 16:10:16 -08:00
Родитель e6e1fb5905
Коммит 47687b23ea
2 изменённых файлов: 10 добавлений и 1 удалений

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

@ -632,6 +632,13 @@ MP4Sample*
MP4Reader::PopSample(TrackType aTrack)
{
MonitorAutoLock mon(mDemuxerMonitor);
return PopSampleLocked(aTrack);
}
MP4Sample*
MP4Reader::PopSampleLocked(TrackType aTrack)
{
mDemuxerMonitor.AssertCurrentThreadOwns();
switch (aTrack) {
case kAudio:
return mDemuxer->DemuxAudioSample();
@ -821,6 +828,7 @@ MP4Reader::Seek(int64_t aTime,
{
LOG("MP4Reader::Seek(%lld)", aTime);
MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
MonitorAutoLock mon(mDemuxerMonitor);
if (!mDecoder->GetResource()->IsTransportSeekable() || !mDemuxer->CanSeek()) {
VLOG("Seek() END (Unseekable)");
return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
@ -829,7 +837,7 @@ MP4Reader::Seek(int64_t aTime,
mQueuedVideoSample = nullptr;
if (mDemuxer->HasValidVideo()) {
mDemuxer->SeekVideo(aTime);
mQueuedVideoSample = PopSample(kVideo);
mQueuedVideoSample = PopSampleLocked(kVideo);
}
if (mDemuxer->HasValidAudio()) {
mDemuxer->SeekAudio(

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

@ -102,6 +102,7 @@ private:
// Blocks until the demuxer produces an sample of specified type.
// Returns nullptr on error on EOS. Caller must delete sample.
mp4_demuxer::MP4Sample* PopSample(mp4_demuxer::TrackType aTrack);
mp4_demuxer::MP4Sample* PopSampleLocked(mp4_demuxer::TrackType aTrack);
bool SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed);