Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: webkit/media/webmediaplayer_impl.cc

Issue 8980008: Integrate HTMLMediaElement with Web Audio API's MediaElementAudioSourceNode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "content/renderer/render_audiosourceprovider.h"
14 #include "media/base/composite_data_source_factory.h" 15 #include "media/base/composite_data_source_factory.h"
15 #include "media/base/filter_collection.h" 16 #include "media/base/filter_collection.h"
16 #include "media/base/limits.h" 17 #include "media/base/limits.h"
17 #include "media/base/media_log.h" 18 #include "media/base/media_log.h"
18 #include "media/base/media_switches.h" 19 #include "media/base/media_switches.h"
19 #include "media/base/pipeline_impl.h" 20 #include "media/base/pipeline_impl.h"
20 #include "media/base/video_frame.h" 21 #include "media/base/video_frame.h"
21 #include "media/filters/chunk_demuxer_factory.h" 22 #include "media/filters/chunk_demuxer_factory.h"
22 #include "media/filters/dummy_demuxer_factory.h" 23 #include "media/filters/dummy_demuxer_factory.h"
23 #include "media/filters/ffmpeg_audio_decoder.h" 24 #include "media/filters/ffmpeg_audio_decoder.h"
24 #include "media/filters/ffmpeg_demuxer_factory.h" 25 #include "media/filters/ffmpeg_demuxer_factory.h"
25 #include "media/filters/ffmpeg_video_decoder.h" 26 #include "media/filters/ffmpeg_video_decoder.h"
26 #include "media/filters/null_audio_renderer.h" 27 #include "media/filters/null_audio_renderer.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide rClient.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
32 #include "v8/include/v8.h" 35 #include "v8/include/v8.h"
33 #include "webkit/media/buffered_data_source.h" 36 #include "webkit/media/buffered_data_source.h"
34 #include "webkit/media/media_stream_client.h" 37 #include "webkit/media/media_stream_client.h"
35 #include "webkit/media/simple_data_source.h" 38 #include "webkit/media/simple_data_source.h"
36 #include "webkit/media/video_renderer_impl.h" 39 #include "webkit/media/video_renderer_impl.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 98 }
96 99
97 } // namespace 100 } // namespace
98 101
99 namespace webkit_media { 102 namespace webkit_media {
100 103
101 WebMediaPlayerImpl::WebMediaPlayerImpl( 104 WebMediaPlayerImpl::WebMediaPlayerImpl(
102 WebKit::WebMediaPlayerClient* client, 105 WebKit::WebMediaPlayerClient* client,
103 base::WeakPtr<WebMediaPlayerDelegate> delegate, 106 base::WeakPtr<WebMediaPlayerDelegate> delegate,
104 media::FilterCollection* collection, 107 media::FilterCollection* collection,
108 media::AudioRendererSink::RenderCallback* render_callback,
105 media::MessageLoopFactory* message_loop_factory, 109 media::MessageLoopFactory* message_loop_factory,
106 MediaStreamClient* media_stream_client, 110 MediaStreamClient* media_stream_client,
107 media::MediaLog* media_log) 111 media::MediaLog* media_log)
108 : network_state_(WebKit::WebMediaPlayer::Empty), 112 : audio_source_provider_(0),
tommi (sloooow) - chröme 2011/12/19 15:26:24 nit: this isn't needed since audio_source_provider
Chris Rogers 2011/12/19 21:40:35 Done.
113 network_state_(WebKit::WebMediaPlayer::Empty),
109 ready_state_(WebKit::WebMediaPlayer::HaveNothing), 114 ready_state_(WebKit::WebMediaPlayer::HaveNothing),
110 main_loop_(NULL), 115 main_loop_(NULL),
111 filter_collection_(collection), 116 filter_collection_(collection),
112 pipeline_(NULL), 117 pipeline_(NULL),
113 message_loop_factory_(message_loop_factory), 118 message_loop_factory_(message_loop_factory),
114 paused_(true), 119 paused_(true),
115 seeking_(false), 120 seeking_(false),
116 playback_rate_(0.0f), 121 playback_rate_(0.0f),
117 pending_seek_(false), 122 pending_seek_(false),
118 client_(client), 123 client_(client),
119 proxy_(NULL), 124 proxy_(NULL),
120 delegate_(delegate), 125 delegate_(delegate),
121 media_stream_client_(media_stream_client), 126 media_stream_client_(media_stream_client),
122 media_log_(media_log), 127 media_log_(media_log),
123 is_accelerated_compositing_active_(false), 128 is_accelerated_compositing_active_(false),
124 incremented_externally_allocated_memory_(false) { 129 incremented_externally_allocated_memory_(false) {
125 // Saves the current message loop. 130 // Saves the current message loop.
126 DCHECK(!main_loop_); 131 DCHECK(!main_loop_);
127 main_loop_ = MessageLoop::current(); 132 main_loop_ = MessageLoop::current();
128 media_log_->AddEvent( 133 media_log_->AddEvent(
129 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 134 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
135
136 audio_sink_render_callback_ = render_callback;
tommi (sloooow) - chröme 2011/12/19 15:26:24 initialize in initializer list
137 audio_source_provider_ =
138 new RenderAudioSourceProvider(audio_sink_render_callback_);
tommi (sloooow) - chröme 2011/12/19 15:26:24 initialize this in the initializer list and provid
Chris Rogers 2011/12/19 21:40:35 Fixed to initialize in initializer list. Also, I'
130 } 139 }
131 140
132 bool WebMediaPlayerImpl::Initialize( 141 bool WebMediaPlayerImpl::Initialize(
133 WebKit::WebFrame* frame, 142 WebKit::WebFrame* frame,
134 bool use_simple_data_source) { 143 bool use_simple_data_source) {
135 DCHECK_EQ(main_loop_, MessageLoop::current()); 144 DCHECK_EQ(main_loop_, MessageLoop::current());
136 MessageLoop* pipeline_message_loop = 145 MessageLoop* pipeline_message_loop =
137 message_loop_factory_->GetMessageLoop("PipelineThread"); 146 message_loop_factory_->GetMessageLoop("PipelineThread");
138 if (!pipeline_message_loop) { 147 if (!pipeline_message_loop) {
139 NOTREACHED() << "Could not start PipelineThread"; 148 NOTREACHED() << "Could not start PipelineThread";
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 proxy_ = NULL; 921 proxy_ = NULL;
913 } 922 }
914 } 923 }
915 924
916 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 925 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
917 DCHECK_EQ(main_loop_, MessageLoop::current()); 926 DCHECK_EQ(main_loop_, MessageLoop::current());
918 DCHECK(client_); 927 DCHECK(client_);
919 return client_; 928 return client_;
920 } 929 }
921 930
931 WebKit::WebAudioSourceProvider* WebMediaPlayerImpl::audioSourceProvider() {
932 if (!audio_sink_render_callback_)
tommi (sloooow) - chröme 2011/12/19 15:26:24 maybe a comment on why we don't return the audio s
Chris Rogers 2011/12/19 21:40:35 I've taken this out, since it's no longer relevant
933 return NULL;
934
935 return audio_source_provider_;
936 }
937
922 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 938 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
923 DCHECK_EQ(main_loop_, MessageLoop::current()); 939 DCHECK_EQ(main_loop_, MessageLoop::current());
924 incremented_externally_allocated_memory_ = true; 940 incremented_externally_allocated_memory_ = true;
925 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 941 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
926 } 942 }
927 943
928 } // namespace webkit_media 944 } // namespace webkit_media
OLDNEW
« webkit/media/webmediaplayer_impl.h ('K') | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698