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

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

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 20 matching lines...) Expand all
31 int memory_length, 31 int memory_length,
32 int total_segments, 32 int total_segments,
33 CaptureCallback* capture_callback); 33 CaptureCallback* capture_callback);
34 ~AudioThreadCallback() override; 34 ~AudioThreadCallback() override;
35 35
36 void MapSharedMemory() override; 36 void MapSharedMemory() override;
37 37
38 // Called whenever we receive notifications about pending data. 38 // Called whenever we receive notifications about pending data.
39 void Process(uint32 pending_data) override; 39 void Process(uint32 pending_data) override;
40 40
41 void FramesSkipped(uint32_t frames_skipped) override;
42
41 private: 43 private:
42 int current_segment_id_; 44 int current_segment_id_;
43 uint32 last_buffer_id_; 45 uint32 last_buffer_id_;
44 ScopedVector<media::AudioBus> audio_buses_; 46 ScopedVector<media::AudioBus> audio_buses_;
45 CaptureCallback* capture_callback_; 47 CaptureCallback* capture_callback_;
46 48
47 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); 49 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback);
48 }; 50 };
49 51
50 AudioInputDevice::AudioInputDevice( 52 AudioInputDevice::AudioInputDevice(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 base::AutoLock auto_lock(audio_thread_lock_); 136 base::AutoLock auto_lock(audio_thread_lock_);
135 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice. 137 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice.
136 // Interface changes need to be made; likely, after AudioInputDevice is merged 138 // Interface changes need to be made; likely, after AudioInputDevice is merged
137 // into AudioOutputDevice (http://crbug.com/179597). 139 // into AudioOutputDevice (http://crbug.com/179597).
138 if (stopping_hack_) 140 if (stopping_hack_)
139 return; 141 return;
140 142
141 DCHECK(audio_thread_.IsStopped()); 143 DCHECK(audio_thread_.IsStopped());
142 audio_callback_.reset(new AudioInputDevice::AudioThreadCallback( 144 audio_callback_.reset(new AudioInputDevice::AudioThreadCallback(
143 audio_parameters_, handle, length, total_segments, callback_)); 145 audio_parameters_, handle, length, total_segments, callback_));
144 audio_thread_.Start( 146 audio_thread_.Start(audio_callback_.get(), socket_handle, "AudioInputDevice",
145 audio_callback_.get(), socket_handle, "AudioInputDevice", true); 147 true, true);
146 148
147 state_ = RECORDING; 149 state_ = RECORDING;
148 ipc_->RecordStream(); 150 ipc_->RecordStream();
149 } 151 }
150 152
151 void AudioInputDevice::OnVolume(double volume) { 153 void AudioInputDevice::OnVolume(double volume) {
152 NOTIMPLEMENTED(); 154 NOTIMPLEMENTED();
153 } 155 }
154 156
155 void AudioInputDevice::OnStateChanged( 157 void AudioInputDevice::OnStateChanged(
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 capture_callback_->Capture( 337 capture_callback_->Capture(
336 audio_bus, 338 audio_bus,
337 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms 339 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms
338 buffer->params.volume, 340 buffer->params.volume,
339 buffer->params.key_pressed); 341 buffer->params.key_pressed);
340 342
341 if (++current_segment_id_ >= total_segments_) 343 if (++current_segment_id_ >= total_segments_)
342 current_segment_id_ = 0; 344 current_segment_id_ = 0;
343 } 345 }
344 346
347 void AudioInputDevice::AudioThreadCallback::FramesSkipped(
348 uint32_t frames_skipped) {
349 // Should not be called for input.
350 NOTREACHED();
351 }
352
345 } // namespace media 353 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698