OLD | NEW |
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 25 matching lines...) Expand all Loading... |
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( |
40 Demuxer* demuxer, | 40 Demuxer* demuxer, |
41 bool is_streaming, | 41 bool is_streaming, |
42 bool is_static, | 42 bool is_static, |
43 const base::Closure& ended_cb, | 43 const base::Closure& ended_cb, |
44 const PipelineMetadataCB& metadata_cb, | 44 const PipelineMetadataCB& metadata_cb, |
45 const BufferingStateCB& buffering_state_cb, | 45 const BufferingStateCB& buffering_state_cb, |
| 46 const NaturalSizeChangedCB& natural_size_changed_cb, |
46 const base::Closure& duration_change_cb, | 47 const base::Closure& duration_change_cb, |
47 const AddTextTrackCB& add_text_track_cb, | 48 const AddTextTrackCB& add_text_track_cb, |
48 const base::Closure& waiting_for_decryption_key_cb) { | 49 const base::Closure& waiting_for_decryption_key_cb) { |
49 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
50 DCHECK(state_ == State::CREATED); | 51 DCHECK(state_ == State::CREATED); |
51 DCHECK(demuxer); | 52 DCHECK(demuxer); |
52 | 53 |
53 // Once the pipeline is started, we want to call the seeked callback but | 54 // Once the pipeline is started, we want to call the seeked callback but |
54 // without a time update. | 55 // without a time update. |
55 pending_seeked_cb_ = true; | 56 pending_seeked_cb_ = true; |
56 state_ = State::STARTING; | 57 state_ = State::STARTING; |
57 | 58 |
58 demuxer_ = demuxer; | 59 demuxer_ = demuxer; |
59 is_streaming_ = is_streaming; | 60 is_streaming_ = is_streaming; |
60 is_static_ = is_static; | 61 is_static_ = is_static; |
61 pipeline_->Start( | 62 pipeline_->Start( |
62 demuxer, renderer_factory_cb_.Run(), ended_cb, | 63 demuxer, renderer_factory_cb_.Run(), ended_cb, |
63 BindToCurrentLoop(error_cb_), | 64 BindToCurrentLoop(error_cb_), |
64 BindToCurrentLoop(base::Bind(&PipelineController::OnPipelineStatus, | 65 BindToCurrentLoop(base::Bind(&PipelineController::OnPipelineStatus, |
65 weak_factory_.GetWeakPtr(), State::PLAYING)), | 66 weak_factory_.GetWeakPtr(), State::PLAYING)), |
66 metadata_cb, buffering_state_cb, duration_change_cb, add_text_track_cb, | 67 metadata_cb, buffering_state_cb, natural_size_changed_cb, |
67 waiting_for_decryption_key_cb); | 68 duration_change_cb, add_text_track_cb, waiting_for_decryption_key_cb); |
68 } | 69 } |
69 | 70 |
70 void PipelineController::Seek(base::TimeDelta time, bool time_updated) { | 71 void PipelineController::Seek(base::TimeDelta time, bool time_updated) { |
71 DCHECK(thread_checker_.CalledOnValidThread()); | 72 DCHECK(thread_checker_.CalledOnValidThread()); |
72 | 73 |
73 // It would be slightly more clear to set this in Dispatch(), but we want to | 74 // 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. | 75 // be sure it gets updated even if the seek is elided. |
75 if (time_updated) | 76 if (time_updated) |
76 pending_time_updated_ = true; | 77 pending_time_updated_ = true; |
77 pending_seeked_cb_ = true; | 78 pending_seeked_cb_ = true; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 pending_seeked_cb_ = false; | 240 pending_seeked_cb_ = false; |
240 bool was_pending_time_updated = pending_time_updated_; | 241 bool was_pending_time_updated = pending_time_updated_; |
241 pending_time_updated_ = false; | 242 pending_time_updated_ = false; |
242 seeked_cb_.Run(was_pending_time_updated); | 243 seeked_cb_.Run(was_pending_time_updated); |
243 return; | 244 return; |
244 } | 245 } |
245 } | 246 } |
246 } | 247 } |
247 | 248 |
248 } // namespace media | 249 } // namespace media |
OLD | NEW |