| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/glue/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/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "media/base/composite_data_source_factory.h" | 14 #include "media/base/composite_data_source_factory.h" |
| 15 #include "media/base/filter_collection.h" | 15 #include "media/base/filter_collection.h" |
| 16 #include "media/base/limits.h" | 16 #include "media/base/limits.h" |
| 17 #include "media/base/media_log.h" | 17 #include "media/base/media_log.h" |
| 18 #include "media/base/media_switches.h" | 18 #include "media/base/media_switches.h" |
| 19 #include "media/base/pipeline_impl.h" | 19 #include "media/base/pipeline_impl.h" |
| 20 #include "media/base/video_frame.h" | 20 #include "media/base/video_frame.h" |
| 21 #include "media/filters/chunk_demuxer_factory.h" | 21 #include "media/filters/chunk_demuxer_factory.h" |
| 22 #include "media/filters/dummy_demuxer_factory.h" | 22 #include "media/filters/dummy_demuxer_factory.h" |
| 23 #include "media/filters/ffmpeg_audio_decoder.h" | 23 #include "media/filters/ffmpeg_audio_decoder.h" |
| 24 #include "media/filters/ffmpeg_demuxer_factory.h" | 24 #include "media/filters/ffmpeg_demuxer_factory.h" |
| 25 #include "media/filters/ffmpeg_video_decoder.h" | 25 #include "media/filters/ffmpeg_video_decoder.h" |
| 26 #include "media/filters/null_audio_renderer.h" | 26 #include "media/filters/null_audio_renderer.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 32 #include "v8/include/v8.h" | 32 #include "v8/include/v8.h" |
| 33 #include "webkit/glue/media/buffered_data_source.h" | 33 #include "webkit/media/buffered_data_source.h" |
| 34 #include "webkit/glue/media/simple_data_source.h" | 34 #include "webkit/media/media_stream_client.h" |
| 35 #include "webkit/glue/media/media_stream_client.h" | 35 #include "webkit/media/simple_data_source.h" |
| 36 #include "webkit/glue/media/video_renderer_impl.h" | 36 #include "webkit/media/video_renderer_impl.h" |
| 37 #include "webkit/glue/media/web_video_renderer.h" | 37 #include "webkit/media/web_video_renderer.h" |
| 38 #include "webkit/glue/webmediaplayer_delegate.h" | 38 #include "webkit/media/webmediaplayer_delegate.h" |
| 39 #include "webkit/glue/webmediaplayer_proxy.h" | 39 #include "webkit/media/webmediaplayer_proxy.h" |
| 40 #include "webkit/glue/webvideoframe_impl.h" | 40 #include "webkit/media/webvideoframe_impl.h" |
| 41 | 41 |
| 42 using WebKit::WebCanvas; | 42 using WebKit::WebCanvas; |
| 43 using WebKit::WebRect; | 43 using WebKit::WebRect; |
| 44 using WebKit::WebSize; | 44 using WebKit::WebSize; |
| 45 using media::PipelineStatus; | 45 using media::PipelineStatus; |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 // Amount of extra memory used by each player instance reported to V8. | 49 // Amount of extra memory used by each player instance reported to V8. |
| 50 // It is not exact number -- first, it differs on different platforms, | 50 // It is not exact number -- first, it differs on different platforms, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 (microseconds <= 0 && difference >= 0.5f)) { | 89 (microseconds <= 0 && difference >= 0.5f)) { |
| 90 integer -= 1.0f; | 90 integer -= 1.0f; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Now we can safely cast to int64 microseconds. | 93 // Now we can safely cast to int64 microseconds. |
| 94 return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer)); | 94 return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace | 97 } // namespace |
| 98 | 98 |
| 99 namespace webkit_glue { | 99 namespace webkit_media { |
| 100 | 100 |
| 101 WebMediaPlayerImpl::WebMediaPlayerImpl( | 101 WebMediaPlayerImpl::WebMediaPlayerImpl( |
| 102 WebKit::WebMediaPlayerClient* client, | 102 WebKit::WebMediaPlayerClient* client, |
| 103 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 103 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
| 104 media::FilterCollection* collection, | 104 media::FilterCollection* collection, |
| 105 media::MessageLoopFactory* message_loop_factory, | 105 media::MessageLoopFactory* message_loop_factory, |
| 106 MediaStreamClient* media_stream_client, | 106 MediaStreamClient* media_stream_client, |
| 107 media::MediaLog* media_log) | 107 media::MediaLog* media_log) |
| 108 : network_state_(WebKit::WebMediaPlayer::Empty), | 108 : network_state_(WebKit::WebMediaPlayer::Empty), |
| 109 ready_state_(WebKit::WebMediaPlayer::HaveNothing), | 109 ready_state_(WebKit::WebMediaPlayer::HaveNothing), |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 DCHECK(client_); | 867 DCHECK(client_); |
| 868 return client_; | 868 return client_; |
| 869 } | 869 } |
| 870 | 870 |
| 871 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 871 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 872 DCHECK_EQ(main_loop_, MessageLoop::current()); | 872 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 873 incremented_externally_allocated_memory_ = true; | 873 incremented_externally_allocated_memory_ = true; |
| 874 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 874 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 875 } | 875 } |
| 876 | 876 |
| 877 } // namespace webkit_glue | 877 } // namespace webkit_media |
| OLD | NEW |