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

Unified Diff: content/renderer/pepper/pepper_platform_audio_input_impl.cc

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: relaxing the notreached back to log(error) since nacl tests will otherwise fail Created 8 years, 5 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
Index: content/renderer/pepper/pepper_platform_audio_input_impl.cc
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.cc b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
index effcf2acd112ca650d646ddf510556275ca16739..e8160f66eeec874bbb24de17073d4d3afc0ce158 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.cc
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
@@ -24,7 +24,7 @@ PepperPlatformAudioInputImpl* PepperPlatformAudioInputImpl::Create(
int frames_per_buffer,
webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) {
scoped_refptr<PepperPlatformAudioInputImpl> audio_input(
- new PepperPlatformAudioInputImpl);
+ new PepperPlatformAudioInputImpl());
if (audio_input->Initialize(plugin_delegate, device_id, sample_rate,
frames_per_buffer, client)) {
// Balanced by Release invoked in
@@ -97,7 +97,9 @@ void PepperPlatformAudioInputImpl::OnStreamCreated(
void PepperPlatformAudioInputImpl::OnVolume(double volume) {}
-void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) {}
+void PepperPlatformAudioInputImpl::OnStateChanged(
+ media::AudioInputDeviceIPCDelegate::State state) {
+}
void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) {
DCHECK(ChildProcess::current()->io_message_loop_proxy()->
@@ -113,11 +115,14 @@ void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) {
this));
} else {
// We will be notified by OnStreamCreated().
- filter_->Send(new AudioInputHostMsg_CreateStream(stream_id_, params_,
- device_id, false));
+ ipc_->CreateStream(stream_id_, params_, device_id, false);
}
}
+void PepperPlatformAudioInputImpl::OnIPCClosed() {
+ ipc_ = NULL;
scherkus (not reviewing) 2012/07/24 17:57:48 null deref if stream_id != 0?
tommi (sloooow) - chröme 2012/07/25 13:46:17 See other comment. I didn't want to add reference
+}
+
PepperPlatformAudioInputImpl::~PepperPlatformAudioInputImpl() {
// Make sure we have been shut down. Warning: this may happen on the I/O
// thread!
@@ -135,7 +140,7 @@ PepperPlatformAudioInputImpl::PepperPlatformAudioInputImpl()
stream_id_(0),
main_message_loop_proxy_(base::MessageLoopProxy::current()),
shutdown_called_(false) {
- filter_ = RenderThreadImpl::current()->audio_input_message_filter();
+ ipc_ = RenderThreadImpl::current()->audio_input_message_filter();
}
bool PepperPlatformAudioInputImpl::Initialize(
@@ -180,17 +185,16 @@ void PepperPlatformAudioInputImpl::InitializeOnIOThread(int session_id) {
// Make sure we don't call init more than once.
DCHECK_EQ(0, stream_id_);
- stream_id_ = filter_->AddDelegate(this);
+ stream_id_ = ipc_->AddDelegate(this);
DCHECK_NE(0, stream_id_);
if (!session_id) {
// We will be notified by OnStreamCreated().
- filter_->Send(new AudioInputHostMsg_CreateStream(
- stream_id_, params_,
- media::AudioManagerBase::kDefaultDeviceId, false));
+ ipc_->CreateStream(stream_id_, params_,
+ media::AudioManagerBase::kDefaultDeviceId, false);
} else {
// We will be notified by OnDeviceReady().
- filter_->Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id));
+ ipc_->StartDevice(stream_id_, session_id);
}
}
@@ -199,7 +203,7 @@ void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() {
BelongsToCurrentThread());
if (stream_id_)
- filter_->Send(new AudioInputHostMsg_RecordStream(stream_id_));
+ ipc_->RecordStream(stream_id_);
}
void PepperPlatformAudioInputImpl::StopCaptureOnIOThread() {
@@ -208,7 +212,7 @@ void PepperPlatformAudioInputImpl::StopCaptureOnIOThread() {
// TODO(yzshen): We cannot re-start capturing if the stream is closed.
if (stream_id_)
- filter_->Send(new AudioInputHostMsg_CloseStream(stream_id_));
+ ipc_->CloseStream(stream_id_);
}
void PepperPlatformAudioInputImpl::ShutDownOnIOThread() {
@@ -221,8 +225,8 @@ void PepperPlatformAudioInputImpl::ShutDownOnIOThread() {
shutdown_called_ = true;
if (stream_id_) {
- filter_->Send(new AudioInputHostMsg_CloseStream(stream_id_));
- filter_->RemoveDelegate(stream_id_);
+ ipc_->CloseStream(stream_id_);
+ ipc_->RemoveDelegate(stream_id_);
stream_id_ = 0;
}

Powered by Google App Engine
This is Rietveld 408576698