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

Side by Side Diff: media/filters/pipeline_controller.cc

Issue 1904793002: Move Pipeline permanent callbacks into Pipeline::Client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/pipeline_controller.h" 5 #include "media/filters/pipeline_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "media/base/bind_to_current_loop.h" 9 #include "media/base/bind_to_current_loop.h"
10 #include "media/base/demuxer.h" 10 #include "media/base/demuxer.h"
(...skipping 18 matching lines...) Expand all
29 DCHECK(!suspended_cb_.is_null()); 29 DCHECK(!suspended_cb_.is_null());
30 DCHECK(!error_cb_.is_null()); 30 DCHECK(!error_cb_.is_null());
31 } 31 }
32 32
33 PipelineController::~PipelineController() { 33 PipelineController::~PipelineController() {
34 DCHECK(thread_checker_.CalledOnValidThread()); 34 DCHECK(thread_checker_.CalledOnValidThread());
35 } 35 }
36 36
37 // TODO(sandersd): If there is a pending suspend, don't call pipeline_.Start() 37 // TODO(sandersd): If there is a pending suspend, don't call pipeline_.Start()
38 // until Resume(). 38 // until Resume().
39 void PipelineController::Start( 39 void PipelineController::Start(Demuxer* demuxer,
40 Demuxer* demuxer, 40 Pipeline::Client* client,
41 bool is_streaming, 41 bool is_streaming,
42 bool is_static, 42 bool is_static) {
43 const base::Closure& ended_cb,
44 const PipelineMetadataCB& metadata_cb,
45 const BufferingStateCB& buffering_state_cb,
46 const base::Closure& duration_change_cb,
47 const AddTextTrackCB& add_text_track_cb,
48 const base::Closure& waiting_for_decryption_key_cb) {
49 DCHECK(thread_checker_.CalledOnValidThread()); 43 DCHECK(thread_checker_.CalledOnValidThread());
50 DCHECK(state_ == State::CREATED); 44 DCHECK(state_ == State::CREATED);
51 DCHECK(demuxer); 45 DCHECK(demuxer);
52 46
53 // Once the pipeline is started, we want to call the seeked callback but 47 // Once the pipeline is started, we want to call the seeked callback but
54 // without a time update. 48 // without a time update.
55 pending_seeked_cb_ = true; 49 pending_seeked_cb_ = true;
56 state_ = State::STARTING; 50 state_ = State::STARTING;
57 51
58 demuxer_ = demuxer; 52 demuxer_ = demuxer;
59 is_streaming_ = is_streaming; 53 is_streaming_ = is_streaming;
60 is_static_ = is_static; 54 is_static_ = is_static;
61 pipeline_->Start( 55 pipeline_->Start(demuxer, renderer_factory_cb_.Run(), client,
62 demuxer, renderer_factory_cb_.Run(), ended_cb, 56 BindToCurrentLoop(
63 BindToCurrentLoop(error_cb_), 57 base::Bind(&PipelineController::OnPipelineStatus,
64 BindToCurrentLoop(base::Bind(&PipelineController::OnPipelineStatus, 58 weak_factory_.GetWeakPtr(), State::PLAYING)));
65 weak_factory_.GetWeakPtr(), State::PLAYING)),
66 metadata_cb, buffering_state_cb, duration_change_cb, add_text_track_cb,
67 waiting_for_decryption_key_cb);
68 } 59 }
69 60
70 void PipelineController::Seek(base::TimeDelta time, bool time_updated) { 61 void PipelineController::Seek(base::TimeDelta time, bool time_updated) {
71 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
72 63
73 // It would be slightly more clear to set this in Dispatch(), but we want to 64 // It would be slightly more clear to set this in Dispatch(), but we want to
74 // be sure it gets updated even if the seek is elided. 65 // be sure it gets updated even if the seek is elided.
75 if (time_updated) 66 if (time_updated)
76 pending_time_updated_ = true; 67 pending_time_updated_ = true;
77 pending_seeked_cb_ = true; 68 pending_seeked_cb_ = true;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 pending_seeked_cb_ = false; 230 pending_seeked_cb_ = false;
240 bool was_pending_time_updated = pending_time_updated_; 231 bool was_pending_time_updated = pending_time_updated_;
241 pending_time_updated_ = false; 232 pending_time_updated_ = false;
242 seeked_cb_.Run(was_pending_time_updated); 233 seeked_cb_.Run(was_pending_time_updated);
243 return; 234 return;
244 } 235 }
245 } 236 }
246 } 237 }
247 238
248 } // namespace media 239 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698