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

Unified Diff: media/blink/webaudiosourceprovider_impl.cc

Issue 495353003: Move WebMediaPlayerImpl and its dependencies to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/blink/webaudiosourceprovider_impl.h ('k') | media/blink/webaudiosourceprovider_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webaudiosourceprovider_impl.cc
diff --git a/content/renderer/media/webaudiosourceprovider_impl.cc b/media/blink/webaudiosourceprovider_impl.cc
similarity index 87%
rename from content/renderer/media/webaudiosourceprovider_impl.cc
rename to media/blink/webaudiosourceprovider_impl.cc
index 4d878ce4ba75445f6099ca4039ba0ef3f5aa0e9d..6637719b0a6980ec34b324f9a75c52454e0c8d27 100644
--- a/content/renderer/media/webaudiosourceprovider_impl.cc
+++ b/media/blink/webaudiosourceprovider_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/renderer/media/webaudiosourceprovider_impl.h"
+#include "media/blink/webaudiosourceprovider_impl.h"
#include <vector>
@@ -14,7 +14,7 @@
using blink::WebVector;
-namespace content {
+namespace media {
namespace {
@@ -47,7 +47,7 @@ class AutoTryLock {
} // namespace
WebAudioSourceProviderImpl::WebAudioSourceProviderImpl(
- const scoped_refptr<media::AudioRendererSink>& sink)
+ const scoped_refptr<AudioRendererSink>& sink)
: channels_(0),
sample_rate_(0),
volume_(1.0),
@@ -70,7 +70,7 @@ void WebAudioSourceProviderImpl::setClient(
// The client will now take control by calling provideInput() periodically.
client_ = client;
- set_format_cb_ = media::BindToCurrentLoop(base::Bind(
+ set_format_cb_ = BindToCurrentLoop(base::Bind(
&WebAudioSourceProviderImpl::OnSetFormat, weak_factory_.GetWeakPtr()));
// If |renderer_| is set, then run |set_format_cb_| to send |client_|
@@ -95,12 +95,12 @@ void WebAudioSourceProviderImpl::provideInput(
const WebVector<float*>& audio_data, size_t number_of_frames) {
if (!bus_wrapper_ ||
static_cast<size_t>(bus_wrapper_->channels()) != audio_data.size()) {
- bus_wrapper_ = media::AudioBus::CreateWrapper(audio_data.size());
+ bus_wrapper_ = AudioBus::CreateWrapper(static_cast<int>(audio_data.size()));
}
- bus_wrapper_->set_frames(number_of_frames);
+ bus_wrapper_->set_frames(static_cast<int>(number_of_frames));
for (size_t i = 0; i < audio_data.size(); ++i)
- bus_wrapper_->SetChannelData(i, audio_data[i]);
+ bus_wrapper_->SetChannelData(static_cast<int>(i), audio_data[i]);
// Use a try lock to avoid contention in the real-time audio thread.
AutoTryLock auto_try_lock(sink_lock_);
@@ -114,9 +114,13 @@ void WebAudioSourceProviderImpl::provideInput(
DCHECK(renderer_);
DCHECK(client_);
DCHECK_EQ(channels_, bus_wrapper_->channels());
- const size_t frames = renderer_->Render(bus_wrapper_.get(), 0);
- if (frames < number_of_frames)
- bus_wrapper_->ZeroFramesPartial(frames, number_of_frames - frames);
+ const int frames = renderer_->Render(bus_wrapper_.get(), 0);
+ if (frames < static_cast<int>(number_of_frames)) {
+ bus_wrapper_->ZeroFramesPartial(
+ frames,
+ static_cast<int>(number_of_frames - frames));
+ }
+
bus_wrapper_->Scale(volume_);
}
@@ -160,7 +164,7 @@ bool WebAudioSourceProviderImpl::SetVolume(double volume) {
}
void WebAudioSourceProviderImpl::Initialize(
- const media::AudioParameters& params,
+ const AudioParameters& params,
RenderCallback* renderer) {
base::AutoLock auto_lock(sink_lock_);
CHECK(!renderer_);
@@ -186,4 +190,4 @@ void WebAudioSourceProviderImpl::OnSetFormat() {
client_->setFormat(channels_, sample_rate_);
}
-} // namespace content
+} // namespace media
« no previous file with comments | « media/blink/webaudiosourceprovider_impl.h ('k') | media/blink/webaudiosourceprovider_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698