diff options
author | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-13 20:51:17 +0000 |
---|---|---|
committer | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-13 20:51:17 +0000 |
commit | 29f00629a996f94005de49a130d423f7a7d4b048 (patch) | |
tree | 766db9eb1a477c0dd3dd1462ddac9b115d6dce25 /content | |
parent | 6ae4f9694b16310f9d62c1088c21399f5adbb713 (diff) | |
download | chromium_src-29f00629a996f94005de49a130d423f7a7d4b048.zip chromium_src-29f00629a996f94005de49a130d423f7a7d4b048.tar.gz chromium_src-29f00629a996f94005de49a130d423f7a7d4b048.tar.bz2 |
Extends error handling for audio capture and rendering.
AudioDevice now uses OnRenderError() (instead of OnError()) and AudioInputDevice uses OnCaptureError().
This CL only enables these callbacks. A follow-up will add support for actual usage as well.
BUG=none
TEST=content_unittests
Review URL: http://codereview.chromium.org/9378003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/media/audio_input_renderer_host.cc | 12 | ||||
-rw-r--r-- | content/renderer/media/audio_device.cc | 2 | ||||
-rw-r--r-- | content/renderer/media/audio_input_device.cc | 2 | ||||
-rw-r--r-- | content/renderer/media/audio_input_device.h | 1 | ||||
-rw-r--r-- | content/renderer/media/audio_renderer_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/media/audio_renderer_impl.h | 2 | ||||
-rw-r--r-- | content/renderer/media/renderer_webaudiodevice_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/media/renderer_webaudiodevice_impl.h | 2 | ||||
-rw-r--r-- | content/renderer/media/webrtc_audio_device_impl.cc | 18 | ||||
-rw-r--r-- | content/renderer/media/webrtc_audio_device_impl.h | 5 |
10 files changed, 30 insertions, 18 deletions
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.cc b/content/browser/renderer_host/media/audio_input_renderer_host.cc index 4c6b0b4..bc9a0fb 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_input_renderer_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -73,9 +73,8 @@ void AudioInputRendererHost::OnError( BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&AudioInputRendererHost::DoHandleError, this, - make_scoped_refptr(controller), - error_code)); + base::Bind(&AudioInputRendererHost::DoHandleError, + this, make_scoped_refptr(controller), error_code)); } void AudioInputRendererHost::OnData(media::AudioInputController* controller, @@ -311,9 +310,8 @@ void AudioInputRendererHost::OnGetVolume(int stream_id) { } void AudioInputRendererHost::SendErrorMessage(int stream_id) { - // TODO(henrika): error state for audio input is not unique - Send(new AudioMsg_NotifyStreamStateChanged(stream_id, - kAudioStreamError)); + Send(new AudioInputMsg_NotifyStreamStateChanged(stream_id, + kAudioStreamError)); } void AudioInputRendererHost::DeleteEntries() { diff --git a/content/renderer/media/audio_device.cc b/content/renderer/media/audio_device.cc index bb059c8..44f86d0 100644 --- a/content/renderer/media/audio_device.cc +++ b/content/renderer/media/audio_device.cc @@ -191,7 +191,7 @@ void AudioDevice::SetVolumeOnIOThread(double volume) { void AudioDevice::OnStateChanged(AudioStreamState state) { if (state == kAudioStreamError) { DLOG(WARNING) << "AudioDevice::OnStateChanged(kError)"; - callback_->OnError(); + callback_->OnRenderError(); } } diff --git a/content/renderer/media/audio_input_device.cc b/content/renderer/media/audio_input_device.cc index 6091ac1..328b82a 100644 --- a/content/renderer/media/audio_input_device.cc +++ b/content/renderer/media/audio_input_device.cc @@ -222,6 +222,8 @@ void AudioInputDevice::OnStateChanged(AudioStreamState state) { break; case kAudioStreamError: DLOG(WARNING) << "AudioInputDevice::OnStateChanged(kError)"; + if (callback_) + callback_->OnCaptureError(); break; default: NOTREACHED(); diff --git a/content/renderer/media/audio_input_device.h b/content/renderer/media/audio_input_device.h index ceb4550..7999bc4 100644 --- a/content/renderer/media/audio_input_device.h +++ b/content/renderer/media/audio_input_device.h @@ -97,6 +97,7 @@ class CONTENT_EXPORT AudioInputDevice virtual void Capture(const std::vector<float*>& audio_data, size_t number_of_frames, size_t audio_delay_milliseconds) = 0; + virtual void OnCaptureError() = 0; protected: virtual ~CaptureCallback() {} }; diff --git a/content/renderer/media/audio_renderer_impl.cc b/content/renderer/media/audio_renderer_impl.cc index 09d866c..e2568da 100644 --- a/content/renderer/media/audio_renderer_impl.cc +++ b/content/renderer/media/audio_renderer_impl.cc @@ -245,7 +245,7 @@ size_t AudioRendererImpl::Render(const std::vector<float*>& audio_data, return filled_frames; } -void AudioRendererImpl::OnError() { +void AudioRendererImpl::OnRenderError() { host()->DisableAudioRenderer(); } diff --git a/content/renderer/media/audio_renderer_impl.h b/content/renderer/media/audio_renderer_impl.h index 7d9c54d9..5660c11 100644 --- a/content/renderer/media/audio_renderer_impl.h +++ b/content/renderer/media/audio_renderer_impl.h @@ -81,7 +81,7 @@ class CONTENT_EXPORT AudioRendererImpl virtual size_t Render(const std::vector<float*>& audio_data, size_t number_of_frames, size_t audio_delay_milliseconds) OVERRIDE; - virtual void OnError() OVERRIDE; + virtual void OnRenderError() OVERRIDE; // Accessors used by tests. base::Time earliest_end_time() const { diff --git a/content/renderer/media/renderer_webaudiodevice_impl.cc b/content/renderer/media/renderer_webaudiodevice_impl.cc index a59e365..03778f1 100644 --- a/content/renderer/media/renderer_webaudiodevice_impl.cc +++ b/content/renderer/media/renderer_webaudiodevice_impl.cc @@ -52,6 +52,6 @@ size_t RendererWebAudioDeviceImpl::Render(const std::vector<float*>& audio_data, return number_of_frames; } -void RendererWebAudioDeviceImpl::OnError() { +void RendererWebAudioDeviceImpl::OnRenderError() { // TODO(crogers): implement error handling. } diff --git a/content/renderer/media/renderer_webaudiodevice_impl.h b/content/renderer/media/renderer_webaudiodevice_impl.h index 7b5717f..b895d03 100644 --- a/content/renderer/media/renderer_webaudiodevice_impl.h +++ b/content/renderer/media/renderer_webaudiodevice_impl.h @@ -30,7 +30,7 @@ class RendererWebAudioDeviceImpl : public WebKit::WebAudioDevice, virtual size_t Render(const std::vector<float*>& audio_data, size_t number_of_frames, size_t audio_delay_milliseconds) OVERRIDE; - virtual void OnError() OVERRIDE; + virtual void OnRenderError() OVERRIDE; private: scoped_refptr<AudioDevice> audio_device_; diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc index ec4d0887..783db05 100644 --- a/content/renderer/media/webrtc_audio_device_impl.cc +++ b/content/renderer/media/webrtc_audio_device_impl.cc @@ -117,8 +117,10 @@ size_t WebRtcAudioDeviceImpl::Render( return number_of_frames; } -void WebRtcAudioDeviceImpl::OnError() { +void WebRtcAudioDeviceImpl::OnRenderError() { + DCHECK_EQ(MessageLoop::current(), ChildProcess::current()->io_message_loop()); // TODO(henrika): Implement error handling. + LOG(ERROR) << "OnRenderError()"; } void WebRtcAudioDeviceImpl::Capture( @@ -178,8 +180,14 @@ void WebRtcAudioDeviceImpl::Capture( } } +void WebRtcAudioDeviceImpl::OnCaptureError() { + DCHECK_EQ(MessageLoop::current(), ChildProcess::current()->io_message_loop()); + // TODO(henrika): Implement error handling. + LOG(ERROR) << "OnCaptureError()"; +} + void WebRtcAudioDeviceImpl::OnDeviceStarted(const std::string& device_id) { - VLOG(1) << "OnDeviceStarted (device_id=" << device_id << ")"; + DVLOG(1) << "OnDeviceStarted (device_id=" << device_id << ")"; // Empty string is an invalid device id. Do nothing if a valid device has // been started. Otherwise update the |recording_| state to false. if (!device_id.empty()) @@ -861,12 +869,14 @@ int32_t WebRtcAudioDeviceImpl::StereoRecording(bool* enabled) const { } int32_t WebRtcAudioDeviceImpl::SetRecordingChannel(const ChannelType channel) { - NOTIMPLEMENTED(); + DVLOG(2) << "WARNING: WebRtcAudioDeviceImpl::SetRecordingChannel() " + << "NOT IMPLEMENTED"; return -1; } int32_t WebRtcAudioDeviceImpl::RecordingChannel(ChannelType* channel) const { - NOTIMPLEMENTED(); + DVLOG(2) << "WARNING: WebRtcAudioDeviceImpl::RecordingChannel() " + << "NOT IMPLEMENTED"; return -1; } diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h index df2515b..36e37ea 100644 --- a/content/renderer/media/webrtc_audio_device_impl.h +++ b/content/renderer/media/webrtc_audio_device_impl.h @@ -95,7 +95,7 @@ // class CONTENT_EXPORT WebRtcAudioDeviceImpl : NON_EXPORTED_BASE(public webrtc::AudioDeviceModule), - public AudioDevice::RenderCallback, + public media::AudioRendererSink::RenderCallback, public AudioInputDevice::CaptureCallback, public AudioInputDevice::CaptureEventHandler { public: @@ -115,12 +115,13 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl virtual size_t Render(const std::vector<float*>& audio_data, size_t number_of_frames, size_t audio_delay_milliseconds) OVERRIDE; - virtual void OnError() OVERRIDE; + virtual void OnRenderError() OVERRIDE; // AudioInputDevice::CaptureCallback implementation. virtual void Capture(const std::vector<float*>& audio_data, size_t number_of_frames, size_t audio_delay_milliseconds) OVERRIDE; + virtual void OnCaptureError() OVERRIDE; // AudioInputDevice::CaptureEventHandler implementation. virtual void OnDeviceStarted(const std::string& device_id) OVERRIDE; |