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

Unified Diff: media/audio/audio_input_device.cc

Issue 2582533002: Simplify AudioInputRendererHost IPC interface. (Closed)
Patch Set: Rebase. Created 3 years, 11 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: media/audio/audio_input_device.cc
diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc
index 9ebe4805ae010a2b514a95bc819bd47a9754e585..ed5e79d37e2ef5e49f4a07ff5b67eab141a425af 100644
--- a/media/audio/audio_input_device.cc
+++ b/media/audio/audio_input_device.cc
@@ -155,53 +155,33 @@ void AudioInputDevice::OnStreamCreated(
ipc_->RecordStream();
}
-void AudioInputDevice::OnVolume(double volume) {
- NOTIMPLEMENTED();
-}
-
-void AudioInputDevice::OnStateChanged(
- AudioInputIPCDelegateState state) {
+void AudioInputDevice::OnError() {
tommi (sloooow) - chröme 2017/01/09 09:25:19 Nice, OnError makes a lot more sense :)
DCHECK(task_runner()->BelongsToCurrentThread());
// Do nothing if the stream has been closed.
if (state_ < CREATING_STREAM)
return;
- // TODO(miu): Clean-up inconsistent and incomplete handling here.
- // http://crbug.com/180640
- switch (state) {
- case AUDIO_INPUT_IPC_DELEGATE_STATE_STOPPED:
- ShutDownOnIOThread();
- break;
- case AUDIO_INPUT_IPC_DELEGATE_STATE_RECORDING:
- NOTIMPLEMENTED();
- break;
- case AUDIO_INPUT_IPC_DELEGATE_STATE_ERROR:
- DLOG(WARNING) << "AudioInputDevice::OnStateChanged(ERROR)";
- if (state_ == CREATING_STREAM) {
- // At this point, we haven't attempted to start the audio thread.
- // Accessing the hardware might have failed or we may have reached
- // the limit of the number of allowed concurrent streams.
- // We must report the error to the |callback_| so that a potential
- // audio source object will enter the correct state (e.g. 'ended' for
- // a local audio source).
- callback_->OnCaptureError(
- "Maximum allowed input device limit reached or OS failure.");
- } else {
- // Don't dereference the callback object if the audio thread
- // is stopped or stopping. That could mean that the callback
- // object has been deleted.
- // TODO(tommi): Add an explicit contract for clearing the callback
- // object. Possibly require calling Initialize again or provide
- // a callback object via Start() and clear it in Stop().
- base::AutoLock auto_lock_(audio_thread_lock_);
- if (audio_thread_)
- callback_->OnCaptureError("AUDIO_INPUT_IPC_DELEGATE_STATE_ERROR");
- }
- break;
- default:
- NOTREACHED();
- break;
+ DLOG(WARNING) << "AudioInputDevice::OnStateChanged(ERROR)";
+ if (state_ == CREATING_STREAM) {
+ // At this point, we haven't attempted to start the audio thread.
+ // Accessing the hardware might have failed or we may have reached
+ // the limit of the number of allowed concurrent streams.
+ // We must report the error to the |callback_| so that a potential
+ // audio source object will enter the correct state (e.g. 'ended' for
+ // a local audio source).
+ callback_->OnCaptureError(
+ "Maximum allowed input device limit reached or OS failure.");
+ } else {
+ // Don't dereference the callback object if the audio thread
+ // is stopped or stopping. That could mean that the callback
+ // object has been deleted.
+ // TODO(tommi): Add an explicit contract for clearing the callback
+ // object. Possibly require calling Initialize again or provide
+ // a callback object via Start() and clear it in Stop().
+ base::AutoLock auto_lock_(audio_thread_lock_);
+ if (audio_thread_)
+ callback_->OnCaptureError("IPC delegate state error.");
}
}

Powered by Google App Engine
This is Rietveld 408576698