| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.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/bind_to_loop.h" | 18 #include "media/base/bind_to_loop.h" |
| 19 #include "media/base/filter_collection.h" | 19 #include "media/base/filter_collection.h" |
| 20 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
| 21 #include "media/base/media_log.h" | 21 #include "media/base/media_log.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/filters/audio_renderer_impl.h" | 24 #include "media/filters/audio_renderer_impl.h" |
| 25 #include "media/filters/chunk_demuxer.h" | 25 #include "media/filters/chunk_demuxer.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/WebRuntimeFeatures.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 34 #include "v8/include/v8.h" | 33 #include "v8/include/v8.h" |
| 35 #include "webkit/media/buffered_data_source.h" | 34 #include "webkit/media/buffered_data_source.h" |
| 36 #include "webkit/media/filter_helpers.h" | 35 #include "webkit/media/filter_helpers.h" |
| 37 #include "webkit/media/webmediaplayer_delegate.h" | 36 #include "webkit/media/webmediaplayer_delegate.h" |
| 38 #include "webkit/media/webmediaplayer_params.h" | 37 #include "webkit/media/webmediaplayer_params.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 } | 636 } |
| 638 | 637 |
| 639 void WebMediaPlayerImpl::putCurrentFrame( | 638 void WebMediaPlayerImpl::putCurrentFrame( |
| 640 WebKit::WebVideoFrame* web_video_frame) { | 639 WebKit::WebVideoFrame* web_video_frame) { |
| 641 if (!accelerated_compositing_reported_) { | 640 if (!accelerated_compositing_reported_) { |
| 642 accelerated_compositing_reported_ = true; | 641 accelerated_compositing_reported_ = true; |
| 643 DCHECK(frame_->view()->isAcceleratedCompositingActive()); | 642 DCHECK(frame_->view()->isAcceleratedCompositingActive()); |
| 644 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); | 643 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); |
| 645 } | 644 } |
| 646 if (web_video_frame) { | 645 if (web_video_frame) { |
| 647 scoped_refptr<media::VideoFrame> video_frame( | 646 WebVideoFrameImpl* impl = static_cast<WebVideoFrameImpl*>(web_video_frame); |
| 648 WebVideoFrameImpl::toVideoFrame(web_video_frame)); | 647 proxy_->PutCurrentFrame(impl->video_frame); |
| 649 proxy_->PutCurrentFrame(video_frame); | |
| 650 delete web_video_frame; | 648 delete web_video_frame; |
| 651 } else { | 649 } else { |
| 652 proxy_->PutCurrentFrame(NULL); | 650 proxy_->PutCurrentFrame(NULL); |
| 653 } | 651 } |
| 654 } | 652 } |
| 655 | 653 |
| 656 #define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \ | 654 #define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \ |
| 657 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::webkit_name) == \ | 655 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::webkit_name) == \ |
| 658 static_cast<int>(media::ChunkDemuxer::chromium_name), \ | 656 static_cast<int>(media::ChunkDemuxer::chromium_name), \ |
| 659 mismatching_status_enums) | 657 mismatching_status_enums) |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 return audio_source_provider_; | 1208 return audio_source_provider_; |
| 1211 } | 1209 } |
| 1212 | 1210 |
| 1213 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1211 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1214 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1212 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1215 incremented_externally_allocated_memory_ = true; | 1213 incremented_externally_allocated_memory_ = true; |
| 1216 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1214 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1217 } | 1215 } |
| 1218 | 1216 |
| 1219 } // namespace webkit_media | 1217 } // namespace webkit_media |
| OLD | NEW |