Chromium Code Reviews| 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 "webkit/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 WebKit::WebAudioSourceProvider* audio_source_provider, | 108 WebKit::WebAudioSourceProvider* audio_source_provider, |
| 109 media::AudioRendererSink* audio_renderer_sink, | 109 media::AudioRendererSink* audio_renderer_sink, |
| 110 media::MessageLoopFactory* message_loop_factory, | 110 media::MessageLoopFactory* message_loop_factory, |
| 111 MediaStreamClient* media_stream_client, | 111 MediaStreamClient* media_stream_client, |
| 112 media::MediaLog* media_log) | 112 media::MediaLog* media_log) |
| 113 : frame_(frame), | 113 : frame_(frame), |
| 114 network_state_(WebMediaPlayer::NetworkStateEmpty), | 114 network_state_(WebMediaPlayer::NetworkStateEmpty), |
| 115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), | 115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), |
| 116 main_loop_(MessageLoop::current()), | 116 main_loop_(MessageLoop::current()), |
| 117 filter_collection_(collection), | 117 filter_collection_(collection), |
| 118 started_(false), | |
| 119 message_loop_factory_(message_loop_factory), | 118 message_loop_factory_(message_loop_factory), |
|
Ami GONE FROM CHROMIUM
2012/07/30 04:06:21
kill started_ in the .h (and the TODO above it)
| |
| 120 paused_(true), | 119 paused_(true), |
| 121 seeking_(false), | 120 seeking_(false), |
| 122 playback_rate_(0.0f), | 121 playback_rate_(0.0f), |
| 123 pending_seek_(false), | 122 pending_seek_(false), |
| 124 pending_seek_seconds_(0.0f), | 123 pending_seek_seconds_(0.0f), |
| 125 client_(client), | 124 client_(client), |
| 126 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), | 125 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), |
| 127 delegate_(delegate), | 126 delegate_(delegate), |
| 128 media_stream_client_(media_stream_client), | 127 media_stream_client_(media_stream_client), |
| 129 media_log_(media_log), | 128 media_log_(media_log), |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 SetNetworkState(WebMediaPlayer::NetworkStateIdle); | 968 SetNetworkState(WebMediaPlayer::NetworkStateIdle); |
| 970 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) | 969 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) |
| 971 SetNetworkState(WebMediaPlayer::NetworkStateLoading); | 970 SetNetworkState(WebMediaPlayer::NetworkStateLoading); |
| 972 media_log_->AddEvent( | 971 media_log_->AddEvent( |
| 973 media_log_->CreateBooleanEvent( | 972 media_log_->CreateBooleanEvent( |
| 974 media::MediaLogEvent::NETWORK_ACTIVITY_SET, | 973 media::MediaLogEvent::NETWORK_ACTIVITY_SET, |
| 975 "is_downloading_data", is_downloading)); | 974 "is_downloading_data", is_downloading)); |
| 976 } | 975 } |
| 977 | 976 |
| 978 void WebMediaPlayerImpl::StartPipeline() { | 977 void WebMediaPlayerImpl::StartPipeline() { |
| 979 started_ = true; | |
| 980 pipeline_->Start( | 978 pipeline_->Start( |
| 981 filter_collection_.Pass(), | 979 filter_collection_.Pass(), |
| 982 base::Bind(&WebMediaPlayerProxy::PipelineEndedCallback, proxy_.get()), | 980 base::Bind(&WebMediaPlayerProxy::PipelineEndedCallback, proxy_.get()), |
| 983 base::Bind(&WebMediaPlayerProxy::PipelineErrorCallback, proxy_.get()), | 981 base::Bind(&WebMediaPlayerProxy::PipelineErrorCallback, proxy_.get()), |
| 984 base::Bind(&WebMediaPlayerProxy::PipelineInitializationCallback, | 982 base::Bind(&WebMediaPlayerProxy::PipelineInitializationCallback, |
| 985 proxy_.get())); | 983 proxy_.get())); |
| 986 } | 984 } |
| 987 | 985 |
| 988 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) { | 986 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) { |
| 989 DCHECK_EQ(main_loop_, MessageLoop::current()); | 987 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1006 | 1004 |
| 1007 // Tell the data source to abort any pending reads so that the pipeline is | 1005 // Tell the data source to abort any pending reads so that the pipeline is |
| 1008 // not blocked when issuing stop commands to the other filters. | 1006 // not blocked when issuing stop commands to the other filters. |
| 1009 if (proxy_) { | 1007 if (proxy_) { |
| 1010 proxy_->AbortDataSource(); | 1008 proxy_->AbortDataSource(); |
| 1011 proxy_->DemuxerShutdown(); | 1009 proxy_->DemuxerShutdown(); |
| 1012 } | 1010 } |
| 1013 | 1011 |
| 1014 // Make sure to kill the pipeline so there's no more media threads running. | 1012 // Make sure to kill the pipeline so there's no more media threads running. |
| 1015 // Note: stopping the pipeline might block for a long time. | 1013 // Note: stopping the pipeline might block for a long time. |
| 1016 if (started_) { | 1014 base::WaitableEvent waiter(false, false); |
| 1017 base::WaitableEvent waiter(false, false); | 1015 pipeline_->Stop(base::Bind( |
| 1018 pipeline_->Stop(base::Bind( | 1016 &base::WaitableEvent::Signal, base::Unretained(&waiter))); |
| 1019 &base::WaitableEvent::Signal, base::Unretained(&waiter))); | 1017 waiter.Wait(); |
| 1020 waiter.Wait(); | |
| 1021 started_ = false; | |
| 1022 } | |
| 1023 | 1018 |
| 1024 // Let V8 know we are not using extra resources anymore. | 1019 // Let V8 know we are not using extra resources anymore. |
| 1025 if (incremented_externally_allocated_memory_) { | 1020 if (incremented_externally_allocated_memory_) { |
| 1026 v8::V8::AdjustAmountOfExternalAllocatedMemory(-kPlayerExtraMemory); | 1021 v8::V8::AdjustAmountOfExternalAllocatedMemory(-kPlayerExtraMemory); |
| 1027 incremented_externally_allocated_memory_ = false; | 1022 incremented_externally_allocated_memory_ = false; |
| 1028 } | 1023 } |
| 1029 | 1024 |
| 1030 message_loop_factory_.reset(); | 1025 message_loop_factory_.reset(); |
| 1031 | 1026 |
| 1032 // And then detach the proxy, it may live on the render thread for a little | 1027 // And then detach the proxy, it may live on the render thread for a little |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1047 return audio_source_provider_; | 1042 return audio_source_provider_; |
| 1048 } | 1043 } |
| 1049 | 1044 |
| 1050 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1045 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1051 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1046 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1052 incremented_externally_allocated_memory_ = true; | 1047 incremented_externally_allocated_memory_ = true; |
| 1053 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1048 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1054 } | 1049 } |
| 1055 | 1050 |
| 1056 } // namespace webkit_media | 1051 } // namespace webkit_media |
| OLD | NEW |