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

Side by Side Diff: media/audio/audio_input_device.cc

Issue 1703473002: Make AudioOutputDevice restartable and reinitializable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_mixing
Patch Set: Created 4 years, 10 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 "media/audio/audio_input_device.h" 5 #include "media/audio/audio_input_device.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 base::AutoLock auto_lock(audio_thread_lock_); 139 base::AutoLock auto_lock(audio_thread_lock_);
140 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice. 140 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice.
141 // Interface changes need to be made; likely, after AudioInputDevice is merged 141 // Interface changes need to be made; likely, after AudioInputDevice is merged
142 // into AudioOutputDevice (http://crbug.com/179597). 142 // into AudioOutputDevice (http://crbug.com/179597).
143 if (stopping_hack_) 143 if (stopping_hack_)
144 return; 144 return;
145 145
146 DCHECK(audio_thread_.IsStopped()); 146 DCHECK(audio_thread_.IsStopped());
147 audio_callback_.reset(new AudioInputDevice::AudioThreadCallback( 147 audio_callback_.reset(new AudioInputDevice::AudioThreadCallback(
148 audio_parameters_, handle, length, total_segments, callback_)); 148 audio_parameters_, handle, length, total_segments, callback_));
149 audio_thread_.Start( 149 audio_thread_.Start("AudioInputDevice", true);
150 audio_callback_.get(), socket_handle, "AudioInputDevice", true); 150 audio_thread_.StartRun(audio_callback_.get(), socket_handle);
151 151
152 state_ = RECORDING; 152 state_ = RECORDING;
153 ipc_->RecordStream(); 153 ipc_->RecordStream();
154 } 154 }
155 155
156 void AudioInputDevice::OnVolume(double volume) { 156 void AudioInputDevice::OnVolume(double volume) {
157 NOTIMPLEMENTED(); 157 NOTIMPLEMENTED();
158 } 158 }
159 159
160 void AudioInputDevice::OnStateChanged( 160 void AudioInputDevice::OnStateChanged(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 audio_bus, 341 audio_bus,
342 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms 342 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms
343 buffer->params.volume, 343 buffer->params.volume,
344 buffer->params.key_pressed); 344 buffer->params.key_pressed);
345 345
346 if (++current_segment_id_ >= total_segments_) 346 if (++current_segment_id_ >= total_segments_)
347 current_segment_id_ = 0; 347 current_segment_id_ = 0;
348 } 348 }
349 349
350 } // namespace media 350 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698