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

Unified Diff: media/base/pipeline_impl.cc

Issue 2267963002: Add support for cancellation of demuxer reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add tests. Created 4 years, 4 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
« no previous file with comments | « media/base/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 43fdf5eb951113bab49777c1f94e89b3dc55434e..08817780663251f95d48e6abc0afc65e12c65b0a 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -311,6 +311,9 @@ void PipelineImpl::RendererWrapper::Seek(base::TimeDelta time) {
DCHECK(!pending_callbacks_);
SerialRunner::Queue bound_fns;
+ // Abort any reads the renderer may be blocked on.
+ demuxer_->AbortPendingReads();
+
// Pause.
if (text_renderer_) {
bound_fns.Push(base::Bind(&TextRenderer::Pause,
@@ -352,8 +355,7 @@ void PipelineImpl::RendererWrapper::Suspend() {
SetState(kSuspending);
- // Freeze playback and record the media time before flushing. (Flushing clears
- // the value.)
+ // Freeze playback and record the media time before destroying the renderer.
shared_state_.renderer->SetPlaybackRate(0.0);
{
base::AutoLock auto_lock(shared_state_lock_);
@@ -361,6 +363,9 @@ void PipelineImpl::RendererWrapper::Suspend() {
DCHECK(shared_state_.suspend_timestamp != kNoTimestamp);
}
+ // Abort any reads the renderer may be blocked on.
+ demuxer_->AbortPendingReads();
+
// Queue the asynchronous actions required to stop playback.
SerialRunner::Queue fns;
@@ -369,14 +374,7 @@ void PipelineImpl::RendererWrapper::Suspend() {
base::Unretained(text_renderer_.get())));
}
- fns.Push(base::Bind(&Renderer::Flush,
- base::Unretained(shared_state_.renderer.get())));
-
- if (text_renderer_) {
- fns.Push(base::Bind(&TextRenderer::Flush,
- base::Unretained(text_renderer_.get())));
- }
-
+ // No need to flush the renderer since it's going to be destroyed.
pending_callbacks_ = SerialRunner::Run(
fns, base::Bind(&RendererWrapper::CompleteSuspend, weak_this_));
}
« no previous file with comments | « media/base/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698