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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 base::AutoLock auto_lock(lock_); | 59 base::AutoLock auto_lock(lock_); |
60 DCHECK(notified_); | 60 DCHECK(notified_); |
61 return status_; | 61 return status_; |
62 } | 62 } |
63 | 63 |
64 struct Pipeline::PipelineInitState { | 64 struct Pipeline::PipelineInitState { |
65 scoped_refptr<AudioDecoder> audio_decoder; | 65 scoped_refptr<AudioDecoder> audio_decoder; |
66 scoped_refptr<VideoDecoder> video_decoder; | 66 scoped_refptr<VideoDecoder> video_decoder; |
67 }; | 67 }; |
68 | 68 |
69 Pipeline::Pipeline(MessageLoop* message_loop, MediaLog* media_log) | 69 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
70 : message_loop_(message_loop->message_loop_proxy()), | 70 MediaLog* media_log) |
71 : message_loop_(message_loop), | |
71 media_log_(media_log), | 72 media_log_(media_log), |
72 running_(false), | 73 running_(false), |
73 seek_pending_(false), | 74 seek_pending_(false), |
74 stop_pending_(false), | 75 stop_pending_(false), |
75 tearing_down_(false), | 76 tearing_down_(false), |
76 error_caused_teardown_(false), | 77 error_caused_teardown_(false), |
77 playback_rate_change_pending_(false), | 78 playback_rate_change_pending_(false), |
78 did_loading_progress_(false), | 79 did_loading_progress_(false), |
79 total_bytes_(0), | 80 total_bytes_(0), |
80 natural_size_(0, 0), | 81 natural_size_(0, 0), |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 // Continue the initialize task by proceeding to the next stage. | 540 // Continue the initialize task by proceeding to the next stage. |
540 message_loop_->PostTask(FROM_HERE, base::Bind( | 541 message_loop_->PostTask(FROM_HERE, base::Bind( |
541 &Pipeline::InitializeTask, this, status)); | 542 &Pipeline::InitializeTask, this, status)); |
542 } | 543 } |
543 | 544 |
544 // Called from any thread. | 545 // Called from any thread. |
545 // This method makes the PipelineStatusCB behave like a Closure. It | 546 // This method makes the PipelineStatusCB behave like a Closure. It |
546 // makes it look like a host()->SetError() call followed by a call to | 547 // makes it look like a host()->SetError() call followed by a call to |
547 // OnFilterStateTransition() when errors occur. | 548 // OnFilterStateTransition() when errors occur. |
548 // | 549 // |
549 // TODO: Revisit this code when SetError() is removed from FilterHost and | 550 // TODO(scherkus): Revisit this code when SetError() is removed from FilterHost |
550 // all the Closures are converted to PipelineStatusCB. | 551 // and all the Closures are converted to PipelineStatusCB. |
scherkus (not reviewing)
2012/08/10 17:00:09
don't indent -- people with long ldaps get cheated
xhwang
2012/08/10 19:33:33
Done.
| |
551 void Pipeline::OnFilterStateTransition(PipelineStatus status) { | 552 void Pipeline::OnFilterStateTransition(PipelineStatus status) { |
552 if (status != PIPELINE_OK) | 553 if (status != PIPELINE_OK) |
553 SetError(status); | 554 SetError(status); |
554 message_loop_->PostTask(FROM_HERE, base::Bind( | 555 message_loop_->PostTask(FROM_HERE, base::Bind( |
555 &Pipeline::FilterStateTransitionTask, this)); | 556 &Pipeline::FilterStateTransitionTask, this)); |
556 } | 557 } |
557 | 558 |
558 void Pipeline::OnTeardownStateTransition(PipelineStatus status) { | 559 void Pipeline::OnTeardownStateTransition(PipelineStatus status) { |
559 // Ignore any errors during teardown. | 560 // Ignore any errors during teardown. |
560 message_loop_->PostTask(FROM_HERE, base::Bind( | 561 message_loop_->PostTask(FROM_HERE, base::Bind( |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1276 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 1277 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
1277 lock_.AssertAcquired(); | 1278 lock_.AssertAcquired(); |
1278 if (!waiting_for_clock_update_) | 1279 if (!waiting_for_clock_update_) |
1279 return; | 1280 return; |
1280 | 1281 |
1281 waiting_for_clock_update_ = false; | 1282 waiting_for_clock_update_ = false; |
1282 clock_->Play(); | 1283 clock_->Play(); |
1283 } | 1284 } |
1284 | 1285 |
1285 } // namespace media | 1286 } // namespace media |
OLD | NEW |