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

Unified Diff: media/audio/audio_input_device.cc

Issue 1304173002: Log error instead of CHECKing input audio sequence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review. Created 5 years, 4 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
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | media/base/audio_capturer_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7c52371a622c82ef18963b9cb8d60444589982d6 100644
--- a/media/audio/audio_input_device.cc
+++ b/media/audio/audio_input_device.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/memory/scoped_vector.h"
+#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "media/audio/audio_manager_base.h"
@@ -177,7 +178,8 @@ 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 - audio thread still running");
break;
default:
NOTREACHED();
@@ -296,8 +298,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 +311,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 = base::StringPrintf(
+ "Incorrect buffer sequence. Expected = %u. Actual = %u.",
+ last_buffer_id_ + 1, buffer->params.id);
+ LOG(ERROR) << message;
+ capture_callback_->OnCaptureError(message);
+ }
+ if (current_segment_id_ != static_cast<int>(pending_data)) {
+ std::string message = base::StringPrintf(
+ "Segment id not matching. Remote = %u. Local = %d.",
+ pending_data, 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.
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | media/base/audio_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698