Bug 1034957 - don't spin decode task queue waiting for audio frames since it hangs with gstreamer 1.0. r=cpearce

This commit is contained in:
JW Wang 2014-07-30 20:58:00 +02:00
Родитель 10fd962893
Коммит c1d232a768
2 изменённых файлов: 16 добавлений и 3 удалений

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

@ -248,6 +248,17 @@ MediaDecoderReader::RequestAudioData()
!AudioQueue().IsFinished()) {
if (!DecodeAudioData()) {
AudioQueue().Finish();
break;
}
// AudioQueue size is still zero, post a task to try again. Don't spin
// waiting in this while loop since it somehow prevents audio EOS from
// coming in gstreamer 1.x when there is still video buffer waiting to be
// consumed. (|mVideoSinkBufferCount| > 0)
if (AudioQueue().GetSize() == 0 && mTaskQueue) {
RefPtr<nsIRunnable> task(NS_NewRunnableMethod(
this, &MediaDecoderReader::RequestAudioData));
mTaskQueue->Dispatch(task.forget());
return;
}
}
if (AudioQueue().GetSize() > 0) {

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

@ -630,9 +630,11 @@ bool GStreamerReader::DecodeAudioData()
}
int64_t timestamp = GST_BUFFER_TIMESTAMP(buffer);
timestamp = gst_segment_to_stream_time(&mAudioSegment,
GST_FORMAT_TIME, timestamp);
{
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
timestamp = gst_segment_to_stream_time(&mAudioSegment,
GST_FORMAT_TIME, timestamp);
}
timestamp = GST_TIME_AS_USECONDS(timestamp);
int64_t offset = GST_BUFFER_OFFSET(buffer);