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

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
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
13 #include "content/renderer/render_audiosourceprovider.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 media::AudioRendererSink::RenderCallback* audio_render_callback,
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 audio_render_callback_ = audio_render_callback;
110 } 116 }
111 117
112 bool WebMediaPlayerImpl::Initialize( 118 bool WebMediaPlayerImpl::Initialize(
113 WebKit::WebFrame* frame, 119 WebKit::WebFrame* frame,
114 bool use_simple_data_source, 120 bool use_simple_data_source,
115 scoped_refptr<WebVideoRenderer> web_video_renderer) { 121 scoped_refptr<WebVideoRenderer> web_video_renderer) {
116 MessageLoop* pipeline_message_loop = 122 MessageLoop* pipeline_message_loop =
117 message_loop_factory_->GetMessageLoop("PipelineThread"); 123 message_loop_factory_->GetMessageLoop("PipelineThread");
118 if (!pipeline_message_loop) { 124 if (!pipeline_message_loop) {
119 NOTREACHED() << "Could not start PipelineThread"; 125 NOTREACHED() << "Could not start PipelineThread";
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 proxy_ = NULL; 811 proxy_ = NULL;
806 } 812 }
807 } 813 }
808 814
809 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 815 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
810 DCHECK(MessageLoop::current() == main_loop_); 816 DCHECK(MessageLoop::current() == main_loop_);
811 DCHECK(client_); 817 DCHECK(client_);
812 return client_; 818 return client_;
813 } 819 }
814 820
821 WebKit::WebAudioSourceProvider* WebMediaPlayerImpl::audioSourceProvider() {
822 if (!audio_render_callback_)
823 return NULL;
824
825 if (!audio_source_provider_) {
826 // FIXME: should NOT call this in real-time audio thread...
827 audio_source_provider_ = new RenderAudioSourceProvider(audio_render_callback _);
828 }
829
830 return audio_source_provider_;
831 }
832
815 } // namespace webkit_glue 833 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698