OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, | 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, |
6 // potential deadlocks, etc... | 6 // potential deadlocks, etc... |
7 | 7 |
8 #include "media/base/pipeline_impl.h" | 8 #include "media/base/pipeline_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 class PipelineImpl::PipelineInitState { | 57 class PipelineImpl::PipelineInitState { |
58 public: | 58 public: |
59 scoped_refptr<AudioDecoder> audio_decoder_; | 59 scoped_refptr<AudioDecoder> audio_decoder_; |
60 scoped_refptr<VideoDecoder> video_decoder_; | 60 scoped_refptr<VideoDecoder> video_decoder_; |
61 scoped_refptr<CompositeFilter> composite_; | 61 scoped_refptr<CompositeFilter> composite_; |
62 }; | 62 }; |
63 | 63 |
64 PipelineImpl::PipelineImpl(MessageLoop* message_loop, MediaLog* media_log) | 64 PipelineImpl::PipelineImpl(MessageLoop* message_loop, MediaLog* media_log) |
65 : message_loop_(message_loop), | 65 : message_loop_(message_loop), |
66 media_log_(media_log), | 66 media_log_(media_log), |
67 network_activity_(false), | |
68 clock_(new Clock(&base::Time::Now)), | 67 clock_(new Clock(&base::Time::Now)), |
69 waiting_for_clock_update_(false), | 68 waiting_for_clock_update_(false), |
70 state_(kCreated), | 69 state_(kCreated), |
71 current_bytes_(0) { | 70 current_bytes_(0) { |
72 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); | 71 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); |
73 ResetState(); | 72 ResetState(); |
74 media_log_->AddEvent( | 73 media_log_->AddEvent( |
75 media_log_->CreateEvent(MediaLogEvent::PIPELINE_CREATED)); | 74 media_log_->CreateEvent(MediaLogEvent::PIPELINE_CREATED)); |
76 } | 75 } |
77 | 76 |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
864 demuxer_->SetPreload(preload); | 863 demuxer_->SetPreload(preload); |
865 } | 864 } |
866 | 865 |
867 void PipelineImpl::SeekTask(base::TimeDelta time, | 866 void PipelineImpl::SeekTask(base::TimeDelta time, |
868 const PipelineStatusCB& seek_callback) { | 867 const PipelineStatusCB& seek_callback) { |
869 DCHECK_EQ(MessageLoop::current(), message_loop_); | 868 DCHECK_EQ(MessageLoop::current(), message_loop_); |
870 DCHECK(!IsPipelineStopPending()); | 869 DCHECK(!IsPipelineStopPending()); |
871 | 870 |
872 // Suppress seeking if we're not fully started. | 871 // Suppress seeking if we're not fully started. |
873 if (state_ != kStarted && state_ != kEnded) { | 872 if (state_ != kStarted && state_ != kEnded) { |
874 // TODO(scherkus): should we run the callback? I'm tempted to say the API | 873 if (!seek_callback.is_null()) |
875 // will only execute the first Seek() request. | 874 seek_callback.Run(PIPELINE_ERROR_INVALID_STATE); |
Ami GONE FROM CHROMIUM
2011/09/13 20:12:58
Does this still get called, considering the guard
SeRya
2011/09/13 22:14:21
You are right, it's not called. Reverted that line
| |
876 VLOG(1) << "Media pipeline has not started, ignoring seek to " | 875 VLOG(1) << "Media pipeline has not started, ignoring seek to " |
877 << time.InMicroseconds(); | 876 << time.InMicroseconds(); |
878 return; | 877 return; |
879 } | 878 } |
880 | 879 |
881 DCHECK(!seek_pending_); | 880 DCHECK(!seek_pending_); |
882 seek_pending_ = true; | 881 seek_pending_ = true; |
883 | 882 |
884 // We'll need to pause every filter before seeking. The state transition | 883 // We'll need to pause every filter before seeking. The state transition |
885 // is as follows: | 884 // is as follows: |
886 // kStarted/kEnded | 885 // kStarted/kEnded |
887 // kPausing (for each filter) | 886 // kPausing (for each filter) |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1328 case kStopping: | 1327 case kStopping: |
1329 case kStopped: | 1328 case kStopped: |
1330 NOTREACHED() << "Unexpected state for teardown: " << state_; | 1329 NOTREACHED() << "Unexpected state for teardown: " << state_; |
1331 break; | 1330 break; |
1332 // default: intentionally left out to force new states to cause compiler | 1331 // default: intentionally left out to force new states to cause compiler |
1333 // errors. | 1332 // errors. |
1334 }; | 1333 }; |
1335 } | 1334 } |
1336 | 1335 |
1337 } // namespace media | 1336 } // namespace media |
OLD | NEW |