OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/pipeline.h" | 5 #include "media/base/pipeline.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 media_log_->AddEvent( | 104 media_log_->AddEvent( |
105 media_log_->CreateEvent(MediaLogEvent::PIPELINE_DESTROYED)); | 105 media_log_->CreateEvent(MediaLogEvent::PIPELINE_DESTROYED)); |
106 } | 106 } |
107 | 107 |
108 void Pipeline::Start(scoped_ptr<FilterCollection> collection, | 108 void Pipeline::Start(scoped_ptr<FilterCollection> collection, |
109 const PipelineStatusCB& ended_cb, | 109 const PipelineStatusCB& ended_cb, |
110 const PipelineStatusCB& error_cb, | 110 const PipelineStatusCB& error_cb, |
111 const PipelineStatusCB& start_cb) { | 111 const PipelineStatusCB& start_cb) { |
112 base::AutoLock auto_lock(lock_); | 112 base::AutoLock auto_lock(lock_); |
113 if (running_) { | 113 CHECK(!running_) << "Media pipeline is already running"; |
114 NOTREACHED() << "Media pipeline is already running"; | |
115 return; | |
116 } | |
117 | 114 |
118 running_ = true; | 115 running_ = true; |
119 message_loop_->PostTask(FROM_HERE, base::Bind( | 116 message_loop_->PostTask(FROM_HERE, base::Bind( |
120 &Pipeline::StartTask, this, base::Passed(&collection), | 117 &Pipeline::StartTask, this, base::Passed(&collection), |
121 ended_cb, error_cb, start_cb)); | 118 ended_cb, error_cb, start_cb)); |
122 } | 119 } |
123 | 120 |
124 void Pipeline::Stop(const base::Closure& stop_cb) { | 121 void Pipeline::Stop(const base::Closure& stop_cb) { |
125 base::AutoLock auto_lock(lock_); | 122 base::AutoLock auto_lock(lock_); |
126 message_loop_->PostTask(FROM_HERE, base::Bind( | 123 message_loop_->PostTask(FROM_HERE, base::Bind( |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 statistics_.video_bytes_decoded += stats.video_bytes_decoded; | 546 statistics_.video_bytes_decoded += stats.video_bytes_decoded; |
550 statistics_.video_frames_decoded += stats.video_frames_decoded; | 547 statistics_.video_frames_decoded += stats.video_frames_decoded; |
551 statistics_.video_frames_dropped += stats.video_frames_dropped; | 548 statistics_.video_frames_dropped += stats.video_frames_dropped; |
552 } | 549 } |
553 | 550 |
554 void Pipeline::StartTask(scoped_ptr<FilterCollection> filter_collection, | 551 void Pipeline::StartTask(scoped_ptr<FilterCollection> filter_collection, |
555 const PipelineStatusCB& ended_cb, | 552 const PipelineStatusCB& ended_cb, |
556 const PipelineStatusCB& error_cb, | 553 const PipelineStatusCB& error_cb, |
557 const PipelineStatusCB& start_cb) { | 554 const PipelineStatusCB& start_cb) { |
558 DCHECK(message_loop_->BelongsToCurrentThread()); | 555 DCHECK(message_loop_->BelongsToCurrentThread()); |
559 DCHECK_EQ(kCreated, state_); | 556 CHECK_EQ(kCreated, state_) |
| 557 << "Media pipeline cannot be started more than once"; |
| 558 |
560 filter_collection_ = filter_collection.Pass(); | 559 filter_collection_ = filter_collection.Pass(); |
561 ended_cb_ = ended_cb; | 560 ended_cb_ = ended_cb; |
562 error_cb_ = error_cb; | 561 error_cb_ = error_cb; |
563 seek_cb_ = start_cb; | 562 seek_cb_ = start_cb; |
564 | 563 |
565 // Kick off initialization. | 564 // Kick off initialization. |
566 pipeline_init_state_.reset(new PipelineInitState()); | 565 pipeline_init_state_.reset(new PipelineInitState()); |
567 | 566 |
568 SetState(kInitDemuxer); | 567 SetState(kInitDemuxer); |
569 InitializeDemuxer(); | 568 InitializeDemuxer(); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 1216 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
1218 lock_.AssertAcquired(); | 1217 lock_.AssertAcquired(); |
1219 if (!waiting_for_clock_update_) | 1218 if (!waiting_for_clock_update_) |
1220 return; | 1219 return; |
1221 | 1220 |
1222 waiting_for_clock_update_ = false; | 1221 waiting_for_clock_update_ = false; |
1223 clock_->Play(); | 1222 clock_->Play(); |
1224 } | 1223 } |
1225 | 1224 |
1226 } // namespace media | 1225 } // namespace media |
OLD | NEW |