Chromium Code Reviews| Index: media/audio/audio_input_device.cc |
| diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc |
| index 1294c9f764edf801adfe00cc25e9b4815660f37f..bd4fd3f7c43c2bbd1c131ebc5e1a38ff35a62eb9 100644 |
| --- a/media/audio/audio_input_device.cc |
| +++ b/media/audio/audio_input_device.cc |
| @@ -6,11 +6,14 @@ |
| #include "base/bind.h" |
| #include "base/memory/scoped_vector.h" |
| +#include "base/strings/string_number_conversions.h" |
| #include "base/threading/thread_restrictions.h" |
| #include "base/time/time.h" |
| #include "media/audio/audio_manager_base.h" |
| #include "media/base/audio_bus.h" |
| +using base::IntToString; |
| + |
| namespace media { |
| // The number of shared memory buffer segments indicated to browser process |
| @@ -177,7 +180,7 @@ void AudioInputDevice::OnStateChanged( |
| // object. Possibly require calling Initialize again or provide |
| // a callback object via Start() and clear it in Stop(). |
| if (!audio_thread_.IsStopped()) |
| - callback_->OnCaptureError(); |
| + callback_->OnCaptureError("AudioInputDevice::OnStateChanged(ERROR)"); |
|
tommi (sloooow) - chröme
2015/08/21 11:57:01
nit: "AudioInputDevice::OnStateChanged - audio thr
Henrik Grunell
2015/08/21 13:15:33
Done.
|
| break; |
| default: |
| NOTREACHED(); |
| @@ -296,8 +299,6 @@ void AudioInputDevice::AudioThreadCallback::MapSharedMemory() { |
| } |
| void AudioInputDevice::AudioThreadCallback::Process(uint32 pending_data) { |
| - CHECK_EQ(current_segment_id_, static_cast<int>(pending_data)); |
| - |
| // The shared memory represents parameters, size of the data buffer and the |
| // actual data buffer containing audio data. Map the memory into this |
| // structure and parse out parameters and the data area. |
| @@ -311,7 +312,20 @@ void AudioInputDevice::AudioThreadCallback::Process(uint32 pending_data) { |
| segment_length_ - sizeof(AudioInputBufferParameters)); |
| // Verify correct sequence. |
| - CHECK_EQ(last_buffer_id_ + 1, buffer->params.id); |
| + if (buffer->params.id != last_buffer_id_ + 1) { |
| + std::string message = "Incorrect buffer sequence. Expected = " + |
| + IntToString(last_buffer_id_ + 1) + |
| + " Actual = " + IntToString(buffer->params.id); |
|
tommi (sloooow) - chröme
2015/08/21 11:57:01
can we use StringPrintf?
Henrik Grunell
2015/08/21 13:15:33
Sure, done.
|
| + LOG(ERROR) << message; |
| + capture_callback_->OnCaptureError(message); |
| + } |
| + if (current_segment_id_ != static_cast<int>(pending_data)) { |
| + std::string message = "Segment id not matching. Remote = " + |
| + IntToString(static_cast<int>(pending_data)) + |
| + " Local = " + IntToString(current_segment_id_); |
| + LOG(ERROR) << message; |
| + capture_callback_->OnCaptureError(message); |
| + } |
| last_buffer_id_ = buffer->params.id; |
| // Use pre-allocated audio bus wrapping existing block of shared memory. |