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

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

Issue 11830004: Refactor content::RenderAudioSourceProvider as webkit_media::WebAudioSourceProviderImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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) 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 16 matching lines...) Expand all
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" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
34 #include "v8/include/v8.h" 34 #include "v8/include/v8.h"
35 #include "webkit/media/buffered_data_source.h" 35 #include "webkit/media/buffered_data_source.h"
36 #include "webkit/media/filter_helpers.h" 36 #include "webkit/media/filter_helpers.h"
37 #include "webkit/media/webaudiosourceprovider_impl.h"
37 #include "webkit/media/webmediaplayer_delegate.h" 38 #include "webkit/media/webmediaplayer_delegate.h"
38 #include "webkit/media/webmediaplayer_params.h" 39 #include "webkit/media/webmediaplayer_params.h"
39 #include "webkit/media/webmediaplayer_proxy.h" 40 #include "webkit/media/webmediaplayer_proxy.h"
40 #include "webkit/media/webmediaplayer_util.h" 41 #include "webkit/media/webmediaplayer_util.h"
41 #include "webkit/media/webvideoframe_impl.h" 42 #include "webkit/media/webvideoframe_impl.h"
42 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 43 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
43 44
44 using WebKit::WebCanvas; 45 using WebKit::WebCanvas;
45 using WebKit::WebMediaPlayer; 46 using WebKit::WebMediaPlayer;
46 using WebKit::WebRect; 47 using WebKit::WebRect;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 playback_rate_(0.0f), 134 playback_rate_(0.0f),
134 pending_seek_(false), 135 pending_seek_(false),
135 pending_seek_seconds_(0.0f), 136 pending_seek_seconds_(0.0f),
136 client_(client), 137 client_(client),
137 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), 138 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)),
138 delegate_(delegate), 139 delegate_(delegate),
139 media_stream_client_(params.media_stream_client()), 140 media_stream_client_(params.media_stream_client()),
140 media_log_(params.media_log()), 141 media_log_(params.media_log()),
141 accelerated_compositing_reported_(false), 142 accelerated_compositing_reported_(false),
142 incremented_externally_allocated_memory_(false), 143 incremented_externally_allocated_memory_(false),
143 audio_source_provider_(params.audio_source_provider()),
144 audio_renderer_sink_(params.audio_renderer_sink()),
145 is_local_source_(false), 144 is_local_source_(false),
146 supports_save_(true), 145 supports_save_(true),
147 starting_(false) { 146 starting_(false) {
148 media_log_->AddEvent( 147 media_log_->AddEvent(
149 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 148 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
150 149
151 CHECK(media_thread_.Start()); 150 CHECK(media_thread_.Start());
152 pipeline_ = new media::Pipeline( 151 pipeline_ = new media::Pipeline(
153 media_thread_.message_loop_proxy(), media_log_); 152 media_thread_.message_loop_proxy(), media_log_);
154 153
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 new media::VideoRendererBase( 191 new media::VideoRendererBase(
193 media_thread_.message_loop_proxy(), 192 media_thread_.message_loop_proxy(),
194 set_decryptor_ready_cb, 193 set_decryptor_ready_cb,
195 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_), 194 base::Bind(&WebMediaPlayerProxy::Repaint, proxy_),
196 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::SetOpaque), 195 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::SetOpaque),
197 true); 196 true);
198 filter_collection_->AddVideoRenderer(video_renderer); 197 filter_collection_->AddVideoRenderer(video_renderer);
199 proxy_->set_frame_provider(video_renderer); 198 proxy_->set_frame_provider(video_renderer);
200 199
201 // Create default audio renderer using the null sink if no sink was provided. 200 // Create default audio renderer using the null sink if no sink was provided.
202 scoped_refptr<media::AudioRendererSink> audio_renderer_sink = 201 audio_source_provider_ = new WebAudioSourceProviderImpl(
203 params.audio_renderer_sink(); 202 params.audio_renderer_sink() ? params.audio_renderer_sink() :
204 if (!audio_renderer_sink) 203 new media::NullAudioSink());
205 audio_renderer_sink = new media::NullAudioSink();
206
207 filter_collection_->AddAudioRenderer(new media::AudioRendererImpl( 204 filter_collection_->AddAudioRenderer(new media::AudioRendererImpl(
208 audio_renderer_sink, set_decryptor_ready_cb)); 205 audio_source_provider_, set_decryptor_ready_cb));
209 } 206 }
210 207
211 WebMediaPlayerImpl::~WebMediaPlayerImpl() { 208 WebMediaPlayerImpl::~WebMediaPlayerImpl() {
212 DCHECK_EQ(main_loop_, MessageLoop::current()); 209 DCHECK_EQ(main_loop_, MessageLoop::current());
213 Destroy(); 210 Destroy();
214 media_log_->AddEvent( 211 media_log_->AddEvent(
215 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); 212 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED));
216 213
217 if (delegate_) 214 if (delegate_)
218 delegate_->PlayerGone(this); 215 delegate_->PlayerGone(this);
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 return audio_source_provider_; 1208 return audio_source_provider_;
1212 } 1209 }
1213 1210
1214 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 1211 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
1215 DCHECK_EQ(main_loop_, MessageLoop::current()); 1212 DCHECK_EQ(main_loop_, MessageLoop::current());
1216 incremented_externally_allocated_memory_ = true; 1213 incremented_externally_allocated_memory_ = true;
1217 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 1214 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
1218 } 1215 }
1219 1216
1220 } // namespace webkit_media 1217 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698