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

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

Issue 7631033: Very early implementation for HTMLMediaElement / Web Audio API integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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) 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/glue/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "content/renderer/media/audio_renderer_impl.h"
scherkus (not reviewing) 2011/08/23 15:16:01 src/webkit cannot depend on src/content code what
Chris Rogers 2011/08/24 00:41:52 I've abstracted this a bit more and now am dealing
13 #include "content/renderer/renderer_webaudiosourceprovider_impl.h"
12 #include "media/base/composite_data_source_factory.h" 14 #include "media/base/composite_data_source_factory.h"
13 #include "media/base/filter_collection.h" 15 #include "media/base/filter_collection.h"
14 #include "media/base/limits.h" 16 #include "media/base/limits.h"
15 #include "media/base/media_log.h" 17 #include "media/base/media_log.h"
16 #include "media/base/media_switches.h" 18 #include "media/base/media_switches.h"
17 #include "media/base/pipeline_impl.h" 19 #include "media/base/pipeline_impl.h"
18 #include "media/base/video_frame.h" 20 #include "media/base/video_frame.h"
19 #include "media/filters/adaptive_demuxer.h" 21 #include "media/filters/adaptive_demuxer.h"
20 #include "media/filters/chunk_demuxer_factory.h" 22 #include "media/filters/chunk_demuxer_factory.h"
21 #include "media/filters/ffmpeg_audio_decoder.h" 23 #include "media/filters/ffmpeg_audio_decoder.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer)); 81 return base::TimeDelta::FromMicroseconds(static_cast<int64>(integer));
80 } 82 }
81 83
82 } // namespace 84 } // namespace
83 85
84 namespace webkit_glue { 86 namespace webkit_glue {
85 87
86 WebMediaPlayerImpl::WebMediaPlayerImpl( 88 WebMediaPlayerImpl::WebMediaPlayerImpl(
87 WebKit::WebMediaPlayerClient* client, 89 WebKit::WebMediaPlayerClient* client,
88 media::FilterCollection* collection, 90 media::FilterCollection* collection,
91 AudioRendererImpl* audio_renderer,
89 media::MessageLoopFactory* message_loop_factory, 92 media::MessageLoopFactory* message_loop_factory,
90 MediaStreamClient* media_stream_client, 93 MediaStreamClient* media_stream_client,
91 media::MediaLog* media_log) 94 media::MediaLog* media_log)
92 : network_state_(WebKit::WebMediaPlayer::Empty), 95 : audio_source_provider_(0),
96 network_state_(WebKit::WebMediaPlayer::Empty),
93 ready_state_(WebKit::WebMediaPlayer::HaveNothing), 97 ready_state_(WebKit::WebMediaPlayer::HaveNothing),
94 main_loop_(NULL), 98 main_loop_(NULL),
95 filter_collection_(collection), 99 filter_collection_(collection),
96 pipeline_(NULL), 100 pipeline_(NULL),
97 message_loop_factory_(message_loop_factory), 101 message_loop_factory_(message_loop_factory),
98 paused_(true), 102 paused_(true),
99 seeking_(false), 103 seeking_(false),
100 playback_rate_(0.0f), 104 playback_rate_(0.0f),
101 client_(client), 105 client_(client),
102 proxy_(NULL), 106 proxy_(NULL),
103 media_stream_client_(media_stream_client), 107 media_stream_client_(media_stream_client),
104 media_log_(media_log) { 108 media_log_(media_log) {
105 // Saves the current message loop. 109 // Saves the current message loop.
106 DCHECK(!main_loop_); 110 DCHECK(!main_loop_);
107 main_loop_ = MessageLoop::current(); 111 main_loop_ = MessageLoop::current();
108 media_log_->AddEvent( 112 media_log_->AddEvent(
109 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 113 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
114
115 printf("audio_renderer = %p\n", audio_renderer);
116 audio_renderer_ = audio_renderer;
110 } 117 }
111 118
112 bool WebMediaPlayerImpl::Initialize( 119 bool WebMediaPlayerImpl::Initialize(
113 WebKit::WebFrame* frame, 120 WebKit::WebFrame* frame,
114 bool use_simple_data_source, 121 bool use_simple_data_source,
115 scoped_refptr<WebVideoRenderer> web_video_renderer) { 122 scoped_refptr<WebVideoRenderer> web_video_renderer) {
116 MessageLoop* pipeline_message_loop = 123 MessageLoop* pipeline_message_loop =
117 message_loop_factory_->GetMessageLoop("PipelineThread"); 124 message_loop_factory_->GetMessageLoop("PipelineThread");
118 if (!pipeline_message_loop) { 125 if (!pipeline_message_loop) {
119 NOTREACHED() << "Could not start PipelineThread"; 126 NOTREACHED() << "Could not start PipelineThread";
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 proxy_ = NULL; 822 proxy_ = NULL;
816 } 823 }
817 } 824 }
818 825
819 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 826 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
820 DCHECK(MessageLoop::current() == main_loop_); 827 DCHECK(MessageLoop::current() == main_loop_);
821 DCHECK(client_); 828 DCHECK(client_);
822 return client_; 829 return client_;
823 } 830 }
824 831
832 WebKit::WebAudioSourceProvider* WebMediaPlayerImpl::webAudioSourceProvider() {
833 if (!audio_source_provider_) {
834 audio_source_provider_ = new RendererWebAudioSourceProviderImpl(audio_render er_.get());
835 // FIXME: should NOT call this in real-time audio thread...
836 audio_renderer_->SetAudioSink(audio_source_provider_);
837 }
838
839 return audio_source_provider_;
840 }
841
825 } // namespace webkit_glue 842 } // namespace webkit_glue
OLDNEW
« content/renderer/renderer_webaudiosourceprovider_impl.h ('K') | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698