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

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.cc

Issue 293673004: Remove unused RenderIO() interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 7 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
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 "content/renderer/media/renderer_webaudiodevice_impl.h" 5 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/renderer/media/audio_device_factory.h" 9 #include "content/renderer/media/audio_device_factory.h"
10 #include "content/renderer/render_frame_impl.h" 10 #include "content/renderer/render_frame_impl.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // an extension creates a object that is passed and used within a page). 50 // an extension creates a object that is passed and used within a page).
51 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); 51 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext();
52 WebView* const web_view = web_frame ? web_frame->view() : NULL; 52 WebView* const web_view = web_frame ? web_frame->view() : NULL;
53 RenderFrame* const render_frame = 53 RenderFrame* const render_frame =
54 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; 54 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL;
55 RenderViewImpl* const render_view = 55 RenderViewImpl* const render_view =
56 web_view ? RenderViewImpl::FromWebView(web_view) : NULL; 56 web_view ? RenderViewImpl::FromWebView(web_view) : NULL;
57 output_device_ = AudioDeviceFactory::NewOutputDevice( 57 output_device_ = AudioDeviceFactory::NewOutputDevice(
58 render_view ? render_view->routing_id() : MSG_ROUTING_NONE, 58 render_view ? render_view->routing_id() : MSG_ROUTING_NONE,
59 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE); 59 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE);
60 output_device_->InitializeUnifiedStream(params_, this, session_id_); 60 output_device_->InitializeWithSessionId(params_, this, session_id_);
61 output_device_->Start(); 61 output_device_->Start();
62 // Note: Default behavior is to auto-play on start. 62 // Note: Default behavior is to auto-play on start.
63 } 63 }
64 64
65 void RendererWebAudioDeviceImpl::stop() { 65 void RendererWebAudioDeviceImpl::stop() {
66 DCHECK(thread_checker_.CalledOnValidThread()); 66 DCHECK(thread_checker_.CalledOnValidThread());
67 67
68 if (output_device_.get()) { 68 if (output_device_.get()) {
69 output_device_->Stop(); 69 output_device_->Stop();
70 output_device_ = NULL; 70 output_device_ = NULL;
71 } 71 }
72 } 72 }
73 73
74 double RendererWebAudioDeviceImpl::sampleRate() { 74 double RendererWebAudioDeviceImpl::sampleRate() {
75 return params_.sample_rate(); 75 return params_.sample_rate();
76 } 76 }
77 77
78 int RendererWebAudioDeviceImpl::Render(media::AudioBus* dest, 78 int RendererWebAudioDeviceImpl::Render(media::AudioBus* dest,
79 int audio_delay_milliseconds) { 79 int audio_delay_milliseconds) {
80 RenderIO(NULL, dest, audio_delay_milliseconds);
81 return dest->frames();
82 }
83
84 void RendererWebAudioDeviceImpl::RenderIO(media::AudioBus* source,
85 media::AudioBus* dest,
86 int audio_delay_milliseconds) {
87 // Make the client callback for an I/O cycle.
88 if (client_callback_) { 80 if (client_callback_) {
89 // Wrap the input pointers using WebVector.
90 size_t source_channels =
91 source ? static_cast<size_t>(source->channels()) : 0;
92 WebVector<float*> web_audio_source_data(source_channels);
93 for (size_t i = 0; i < source_channels; ++i)
94 web_audio_source_data[i] = source->channel(i);
95
96 // Wrap the output pointers using WebVector. 81 // Wrap the output pointers using WebVector.
97 WebVector<float*> web_audio_dest_data( 82 WebVector<float*> web_audio_dest_data(
98 static_cast<size_t>(dest->channels())); 83 static_cast<size_t>(dest->channels()));
99 for (int i = 0; i < dest->channels(); ++i) 84 for (int i = 0; i < dest->channels(); ++i)
100 web_audio_dest_data[i] = dest->channel(i); 85 web_audio_dest_data[i] = dest->channel(i);
101 86
87 // TODO(xians): Remove the following |web_audio_source_data| after
88 // changing the blink interface.
89 WebVector<float*> web_audio_source_data(static_cast<size_t>(0));
102 client_callback_->render(web_audio_source_data, 90 client_callback_->render(web_audio_source_data,
103 web_audio_dest_data, 91 web_audio_dest_data,
104 dest->frames()); 92 dest->frames());
105 } 93 }
94
95 return dest->frames();
106 } 96 }
107 97
108 void RendererWebAudioDeviceImpl::OnRenderError() { 98 void RendererWebAudioDeviceImpl::OnRenderError() {
109 // TODO(crogers): implement error handling. 99 // TODO(crogers): implement error handling.
110 } 100 }
111 101
112 } // namespace content 102 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_webaudiodevice_impl.h ('k') | content/renderer/media/webrtc_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698