| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 COMPILE_ASSERT_MATCHING_ENUM(Anonymous); | 90 COMPILE_ASSERT_MATCHING_ENUM(Anonymous); |
| 91 COMPILE_ASSERT_MATCHING_ENUM(UseCredentials); | 91 COMPILE_ASSERT_MATCHING_ENUM(UseCredentials); |
| 92 #undef COMPILE_ASSERT_MATCHING_ENUM | 92 #undef COMPILE_ASSERT_MATCHING_ENUM |
| 93 | 93 |
| 94 WebMediaPlayerImpl::WebMediaPlayerImpl( | 94 WebMediaPlayerImpl::WebMediaPlayerImpl( |
| 95 WebKit::WebFrame* frame, | 95 WebKit::WebFrame* frame, |
| 96 WebKit::WebMediaPlayerClient* client, | 96 WebKit::WebMediaPlayerClient* client, |
| 97 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 97 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
| 98 media::FilterCollection* collection, | 98 media::FilterCollection* collection, |
| 99 WebKit::WebAudioSourceProvider* audio_source_provider, | 99 WebKit::WebAudioSourceProvider* audio_source_provider, |
| 100 media::AudioRendererSink* audio_renderer_sink, |
| 100 media::MessageLoopFactory* message_loop_factory, | 101 media::MessageLoopFactory* message_loop_factory, |
| 101 MediaStreamClient* media_stream_client, | 102 MediaStreamClient* media_stream_client, |
| 102 media::MediaLog* media_log) | 103 media::MediaLog* media_log) |
| 103 : frame_(frame), | 104 : frame_(frame), |
| 104 network_state_(WebMediaPlayer::NetworkStateEmpty), | 105 network_state_(WebMediaPlayer::NetworkStateEmpty), |
| 105 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), | 106 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), |
| 106 main_loop_(MessageLoop::current()), | 107 main_loop_(MessageLoop::current()), |
| 107 filter_collection_(collection), | 108 filter_collection_(collection), |
| 108 started_(false), | 109 started_(false), |
| 109 message_loop_factory_(message_loop_factory), | 110 message_loop_factory_(message_loop_factory), |
| 110 paused_(true), | 111 paused_(true), |
| 111 seeking_(false), | 112 seeking_(false), |
| 112 playback_rate_(0.0f), | 113 playback_rate_(0.0f), |
| 113 pending_seek_(false), | 114 pending_seek_(false), |
| 114 pending_seek_seconds_(0.0f), | 115 pending_seek_seconds_(0.0f), |
| 115 client_(client), | 116 client_(client), |
| 116 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), | 117 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), |
| 117 delegate_(delegate), | 118 delegate_(delegate), |
| 118 media_stream_client_(media_stream_client), | 119 media_stream_client_(media_stream_client), |
| 119 media_log_(media_log), | 120 media_log_(media_log), |
| 120 accelerated_compositing_reported_(false), | 121 accelerated_compositing_reported_(false), |
| 121 incremented_externally_allocated_memory_(false), | 122 incremented_externally_allocated_memory_(false), |
| 122 audio_source_provider_(audio_source_provider), | 123 audio_source_provider_(audio_source_provider), |
| 124 audio_renderer_sink_(audio_renderer_sink), |
| 123 is_local_source_(false) { | 125 is_local_source_(false) { |
| 124 media_log_->AddEvent( | 126 media_log_->AddEvent( |
| 125 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 127 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
| 126 | 128 |
| 127 MessageLoop* pipeline_message_loop = | 129 MessageLoop* pipeline_message_loop = |
| 128 message_loop_factory_->GetMessageLoop("PipelineThread"); | 130 message_loop_factory_->GetMessageLoop("PipelineThread"); |
| 129 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_); | 131 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_); |
| 130 | 132 |
| 131 // Let V8 know we started new thread if we did not did it yet. | 133 // Let V8 know we started new thread if we did not did it yet. |
| 132 // Made separate task to avoid deletion of player currently being created. | 134 // Made separate task to avoid deletion of player currently being created. |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 return audio_source_provider_; | 1023 return audio_source_provider_; |
| 1022 } | 1024 } |
| 1023 | 1025 |
| 1024 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1026 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1025 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1027 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1026 incremented_externally_allocated_memory_ = true; | 1028 incremented_externally_allocated_memory_ = true; |
| 1027 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1029 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1028 } | 1030 } |
| 1029 | 1031 |
| 1030 } // namespace webkit_media | 1032 } // namespace webkit_media |
| OLD | NEW |