Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 13585003: GpuVideoDecoder not to use DemuxerStream after it's stopped. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/base/video_decoder.h ('K') | « media/filters/gpu_video_decoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« media/base/video_decoder.h ('K') | « media/filters/gpu_video_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698