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

Unified Diff: media/base/pipeline_impl.h

Issue 1904793002: Move Pipeline permanent callbacks into Pipeline::Client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CHECK waiter PostTask 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
Index: media/base/pipeline_impl.h
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index da4f347579c6496e5351893c4eac25c7d4308114..a8ba222f4c1d40ccc6cea47689bcc625afcfd9ee 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -76,9 +76,11 @@ class TextRenderer;
// Some annoying differences between the two paths need to be removed first.
class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
public:
- // Constructs a media pipeline that will execute on |task_runner|.
- PipelineImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- MediaLog* media_log);
+ // Constructs a media pipeline that will execute media tasks on
+ // |media_task_runner|.
+ PipelineImpl(
+ const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
+ MediaLog* media_log);
~PipelineImpl() override;
void SetErrorForTesting(PipelineStatus status);
@@ -87,15 +89,9 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
// Pipeline implementation.
void Start(Demuxer* demuxer,
std::unique_ptr<Renderer> renderer,
- const base::Closure& ended_cb,
- const PipelineStatusCB& error_cb,
- const PipelineStatusCB& seek_cb,
- const PipelineMetadataCB& metadata_cb,
- const BufferingStateCB& buffering_state_cb,
- const base::Closure& duration_change_cb,
- const AddTextTrackCB& add_text_track_cb,
- const base::Closure& waiting_for_decryption_key_cb) override;
- void Stop(const base::Closure& stop_cb) override;
+ Client* client,
+ const PipelineStatusCB& seek_cb) override;
+ void Stop() override;
void Seek(base::TimeDelta time, const PipelineStatusCB& seek_cb) override;
bool IsRunning() const override;
double GetPlaybackRate() const override;
@@ -158,6 +154,9 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
// Callback executed by filters to update statistics.
void OnUpdateStatistics(const PipelineStatistics& stats_delta);
+ // Callback executed by renderer when waiting for decryption key.
+ void OnWaitingForDecryptionKey();
+
// The following "task" methods correspond to the public methods, but these
// methods are run as the result of posting a task to the Pipeline's
// task runner.
@@ -226,17 +225,19 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
// executing |done_cb| with the final status when completed.
void DoSeek(base::TimeDelta seek_timestamp, const PipelineStatusCB& done_cb);
- // Initiates an asynchronous pause-flush-stop call sequence executing
- // |done_cb| when completed.
- void DoStop(const PipelineStatusCB& done_cb);
- void OnStopCompleted(PipelineStatus status);
+ // Stops media rendering and executes |stop_cb_| when done.
+ void DoStop();
void ReportMetadata();
void BufferingStateChanged(BufferingState new_buffering_state);
+ // Task runner of the thread on which this class is constructed.
+ // Also used to post notifications on Pipeline::Client object.
+ const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+
// Task runner used to execute pipeline tasks.
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
// MediaLog to which to log events.
scoped_refptr<MediaLog> media_log_;
@@ -300,15 +301,6 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
// Temporary callback used for Suspend().
PipelineStatusCB suspend_cb_;
- // Permanent callbacks passed in via Start().
- base::Closure ended_cb_;
- PipelineStatusCB error_cb_;
- PipelineMetadataCB metadata_cb_;
- BufferingStateCB buffering_state_cb_;
- base::Closure duration_change_cb_;
- AddTextTrackCB add_text_track_cb_;
- base::Closure waiting_for_decryption_key_cb_;
-
// Holds the initialized demuxer. Used for seeking. Owned by client.
Demuxer* demuxer_;
@@ -317,6 +309,9 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public DemuxerHost {
std::unique_ptr<Renderer> renderer_;
std::unique_ptr<TextRenderer> text_renderer_;
+ // Holds the client passed on Start().
+ std::unique_ptr<base::WeakPtrFactory<Client>> client_weak_factory_;
xhwang 2016/05/04 06:32:22 Can you add comments about the threading expectati
alokp 2016/05/04 17:40:01 Added comments and also created weak_client_ as su
+
PipelineStatistics statistics_;
std::unique_ptr<SerialRunner> pending_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698