| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 17 #include "media/audio/null_audio_sink.h" | 17 #include "media/audio/null_audio_sink.h" |
| 18 #include "media/base/filter_collection.h" | 18 #include "media/base/filter_collection.h" |
| 19 #include "media/base/limits.h" | 19 #include "media/base/limits.h" |
| 20 #include "media/base/media_log.h" | 20 #include "media/base/media_log.h" |
| 21 #include "media/base/media_switches.h" | 21 #include "media/base/media_switches.h" |
| 22 #include "media/base/pipeline.h" | 22 #include "media/base/pipeline.h" |
| 23 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
| 24 #include "media/crypto/aes_decryptor.h" | 24 #include "media/crypto/hmac_aes_decryptor.h" |
| 25 #include "media/filters/audio_renderer_impl.h" | 25 #include "media/filters/audio_renderer_impl.h" |
| 26 #include "media/filters/video_renderer_base.h" | 26 #include "media/filters/video_renderer_base.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 33 #include "v8/include/v8.h" | 33 #include "v8/include/v8.h" |
| 34 #include "webkit/media/buffered_data_source.h" | 34 #include "webkit/media/buffered_data_source.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_), | 148 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_), |
| 149 base::Bind(&WebMediaPlayerProxy::SetOpaque, proxy_.get()), | 149 base::Bind(&WebMediaPlayerProxy::SetOpaque, proxy_.get()), |
| 150 true); | 150 true); |
| 151 filter_collection_->AddVideoRenderer(video_renderer); | 151 filter_collection_->AddVideoRenderer(video_renderer); |
| 152 proxy_->set_frame_provider(video_renderer); | 152 proxy_->set_frame_provider(video_renderer); |
| 153 | 153 |
| 154 // Create default audio renderer. | 154 // Create default audio renderer. |
| 155 filter_collection_->AddAudioRenderer( | 155 filter_collection_->AddAudioRenderer( |
| 156 new media::AudioRendererImpl(new media::NullAudioSink())); | 156 new media::AudioRendererImpl(new media::NullAudioSink())); |
| 157 | 157 |
| 158 decryptor_.reset(new media::AesDecryptor()); | 158 decryptor_.reset(new media::HmacAesDecryptor()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 WebMediaPlayerImpl::~WebMediaPlayerImpl() { | 161 WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| 162 DCHECK_EQ(main_loop_, MessageLoop::current()); | 162 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 163 Destroy(); | 163 Destroy(); |
| 164 media_log_->AddEvent( | 164 media_log_->AddEvent( |
| 165 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); | 165 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); |
| 166 | 166 |
| 167 if (delegate_) | 167 if (delegate_) |
| 168 delegate_->PlayerGone(this); | 168 delegate_->PlayerGone(this); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 return audio_source_provider_; | 1044 return audio_source_provider_; |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1047 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1048 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1048 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1049 incremented_externally_allocated_memory_ = true; | 1049 incremented_externally_allocated_memory_ = true; |
| 1050 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1050 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 } // namespace webkit_media | 1053 } // namespace webkit_media |
| OLD | NEW |