Index: media/filters/gpu_video_decoder.cc |
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
index 71994156880483ffe34186e97aa6ec1715b8c972..1be435fff93980a096f6ed0f14d04387b0c4df97 100644 |
--- a/media/filters/gpu_video_decoder.cc |
+++ b/media/filters/gpu_video_decoder.cc |
@@ -107,6 +107,7 @@ void GpuVideoDecoder::Stop(const base::Closure& closure) { |
EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
if (!pending_reset_cb_.is_null()) |
base::ResetAndReturn(&pending_reset_cb_).Run(); |
+ demuxer_stream_ = NULL; |
BindToCurrentLoop(closure).Run(); |
} |
@@ -549,14 +550,30 @@ GpuVideoDecoder::~GpuVideoDecoder() { |
DestroyTextures(); |
} |
+void GpuVideoDecoder::ReadFromDemuxerStream() { |
+ DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(demuxer_read_in_progress_); |
+ |
+ // This can happen during the tear-down process. GpuVideoDecoder::Stop() |
+ // returns the |pending_read_cb_| immediately without waiting for the demuxer |
+ // read to be returned. Therefore, this function could be called even after |
+ // the decoder has been stopped. |
+ if (!demuxer_stream_) { |
+ demuxer_read_in_progress_ = false; |
+ return; |
+ } |
+ |
+ demuxer_stream_->Read(base::Bind( |
+ &GpuVideoDecoder::RequestBufferDecode, this)); |
+} |
+ |
void GpuVideoDecoder::EnsureDemuxOrDecode() { |
DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
if (demuxer_read_in_progress_) |
return; |
demuxer_read_in_progress_ = true; |
gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
- &DemuxerStream::Read, demuxer_stream_.get(), |
- base::Bind(&GpuVideoDecoder::RequestBufferDecode, this))); |
+ &GpuVideoDecoder::ReadFromDemuxerStream, this)); |
Ami GONE FROM CHROMIUM
2013/04/04 03:43:22
Do you see a reason not to simply run the Read() h
xhwang
2013/04/04 04:15:23
I think there are two reasons why we always post:
xhwang
2013/04/04 17:05:33
Done.
|
} |
void GpuVideoDecoder::NotifyFlushDone() { |