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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Create default video renderer. | 181 // Create default video renderer. |
182 scoped_refptr<media::VideoRendererBase> video_renderer = | 182 scoped_refptr<media::VideoRendererBase> video_renderer = |
183 new media::VideoRendererBase( | 183 new media::VideoRendererBase( |
184 pipeline_message_loop, | 184 pipeline_message_loop, |
185 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_), | 185 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_), |
186 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::SetOpaque), | 186 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::SetOpaque), |
187 true); | 187 true); |
188 filter_collection_->AddVideoRenderer(video_renderer); | 188 filter_collection_->AddVideoRenderer(video_renderer); |
189 proxy_->set_frame_provider(video_renderer); | 189 proxy_->set_frame_provider(video_renderer); |
190 | 190 |
191 // Create default audio renderer using the null sink if no sink was provided. | 191 media::SetDecryptorReadyCB set_decryptor_ready_cb; |
192 if (!audio_renderer_sink) { | |
193 audio_renderer_sink = new media::NullAudioSink(); | |
194 } | |
195 filter_collection_->AddAudioRenderer( | |
196 new media::AudioRendererImpl(audio_renderer_sink)); | |
197 | |
198 if (WebKit::WebRuntimeFeatures::isEncryptedMediaEnabled()) { | 192 if (WebKit::WebRuntimeFeatures::isEncryptedMediaEnabled()) { |
199 decryptor_.reset(new ProxyDecryptor(message_loop_factory_->GetMessageLoop( | 193 decryptor_.reset(new ProxyDecryptor(message_loop_factory_->GetMessageLoop( |
200 media::MessageLoopFactory::kPipeline), proxy_.get(), client, frame)); | 194 media::MessageLoopFactory::kPipeline), proxy_.get(), client, frame)); |
| 195 set_decryptor_ready_cb = base::Bind(&ProxyDecryptor::SetDecryptorReadyCB, |
| 196 base::Unretained(decryptor_.get())); |
201 } | 197 } |
| 198 |
| 199 // Create default audio renderer using the null sink if no sink was provided. |
| 200 if (!audio_renderer_sink) |
| 201 audio_renderer_sink = new media::NullAudioSink(); |
| 202 |
| 203 filter_collection_->AddAudioRenderer(new media::AudioRendererImpl( |
| 204 audio_renderer_sink, set_decryptor_ready_cb)); |
202 } | 205 } |
203 | 206 |
204 WebMediaPlayerImpl::~WebMediaPlayerImpl() { | 207 WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
205 DCHECK_EQ(main_loop_, MessageLoop::current()); | 208 DCHECK_EQ(main_loop_, MessageLoop::current()); |
206 Destroy(); | 209 Destroy(); |
207 media_log_->AddEvent( | 210 media_log_->AddEvent( |
208 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); | 211 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); |
209 | 212 |
210 if (delegate_) | 213 if (delegate_) |
211 delegate_->PlayerGone(this); | 214 delegate_->PlayerGone(this); |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 return audio_source_provider_; | 1212 return audio_source_provider_; |
1210 } | 1213 } |
1211 | 1214 |
1212 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1215 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
1213 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1216 DCHECK_EQ(main_loop_, MessageLoop::current()); |
1214 incremented_externally_allocated_memory_ = true; | 1217 incremented_externally_allocated_memory_ = true; |
1215 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1218 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
1216 } | 1219 } |
1217 | 1220 |
1218 } // namespace webkit_media | 1221 } // namespace webkit_media |
OLD | NEW |