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

Unified Diff: media/filters/pipeline_controller.cc

Issue 1830913005: Convert WMPI state management to level-triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use EXPECT_TRUE/EXPECT_FALSE. Created 4 years, 8 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/filters/pipeline_controller.h ('k') | media/filters/pipeline_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/pipeline_controller.cc
diff --git a/media/filters/pipeline_controller.cc b/media/filters/pipeline_controller.cc
index 1d5e951a7b2577ab89f30be6759f6e9d64152849..4c7a896efea2b4b88c1148169ae81d7a78ea08e3 100644
--- a/media/filters/pipeline_controller.cc
+++ b/media/filters/pipeline_controller.cc
@@ -16,20 +16,17 @@ PipelineController::PipelineController(
const RendererFactoryCB& renderer_factory_cb,
const SeekedCB& seeked_cb,
const SuspendedCB& suspended_cb,
- const ResumedCB& resumed_cb,
const PipelineStatusCB& error_cb)
: pipeline_(pipeline),
renderer_factory_cb_(renderer_factory_cb),
seeked_cb_(seeked_cb),
suspended_cb_(suspended_cb),
- resumed_cb_(resumed_cb),
error_cb_(error_cb),
weak_factory_(this) {
DCHECK(pipeline_);
DCHECK(!renderer_factory_cb_.is_null());
DCHECK(!seeked_cb_.is_null());
DCHECK(!suspended_cb_.is_null());
- DCHECK(!resumed_cb_.is_null());
DCHECK(!error_cb_.is_null());
}
@@ -114,12 +111,17 @@ void PipelineController::Resume() {
bool PipelineController::IsStable() {
DCHECK(thread_checker_.CalledOnValidThread());
- return (state_ == State::PLAYING);
+ return state_ == State::PLAYING;
}
bool PipelineController::IsSuspended() {
DCHECK(thread_checker_.CalledOnValidThread());
- return (state_ == State::SUSPENDED);
+ return (pending_suspend_ || state_ == State::SUSPENDED) && !pending_resume_;
+}
+
+bool PipelineController::IsPipelineSuspended() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return state_ == State::SUSPENDED;
}
void PipelineController::OnPipelineStatus(State state,
@@ -137,16 +139,7 @@ void PipelineController::OnPipelineStatus(State state,
// Start(), Seek(), or Resume() completed; we can be sure that
// |demuxer_| got the seek it was waiting for.
waiting_for_seek_ = false;
- if (pending_resumed_cb_) {
- pending_resumed_cb_ = false;
-
- // Warning: possibly reentrant. The state may change inside this callback.
- // It must be safe to call Dispatch() twice in a row here.
- resumed_cb_.Run();
- }
} else if (state == State::SUSPENDED) {
- pending_resumed_cb_ = true;
-
// Warning: possibly reentrant. The state may change inside this callback.
// It must be safe to call Dispatch() twice in a row here.
suspended_cb_.Run();
« no previous file with comments | « media/filters/pipeline_controller.h ('k') | media/filters/pipeline_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698