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

Unified Diff: webrtc/modules/audio_device/android/opensles_player.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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: webrtc/modules/audio_device/android/opensles_player.cc
diff --git a/webrtc/modules/audio_device/android/opensles_player.cc b/webrtc/modules/audio_device/android/opensles_player.cc
index 5cf2191c655046ecf606d63d6a9341f1623b99d7..b9ccfd594d36dad0d7b85fbe1f8dbd4f16249f09 100644
--- a/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/webrtc/modules/audio_device/android/opensles_player.cc
@@ -60,37 +60,37 @@ OpenSLESPlayer::OpenSLESPlayer(AudioManager* audio_manager)
OpenSLESPlayer::~OpenSLESPlayer() {
ALOGD("dtor%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
Terminate();
DestroyAudioPlayer();
DestroyMix();
DestroyEngine();
- DCHECK(!engine_object_.Get());
- DCHECK(!engine_);
- DCHECK(!output_mix_.Get());
- DCHECK(!player_);
- DCHECK(!simple_buffer_queue_);
- DCHECK(!volume_);
+ RTC_DCHECK(!engine_object_.Get());
+ RTC_DCHECK(!engine_);
+ RTC_DCHECK(!output_mix_.Get());
+ RTC_DCHECK(!player_);
+ RTC_DCHECK(!simple_buffer_queue_);
+ RTC_DCHECK(!volume_);
}
int OpenSLESPlayer::Init() {
ALOGD("Init%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
return 0;
}
int OpenSLESPlayer::Terminate() {
ALOGD("Terminate%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
StopPlayout();
return 0;
}
int OpenSLESPlayer::InitPlayout() {
ALOGD("InitPlayout%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!initialized_);
- DCHECK(!playing_);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(!initialized_);
+ RTC_DCHECK(!playing_);
CreateEngine();
CreateMix();
initialized_ = true;
@@ -100,9 +100,9 @@ int OpenSLESPlayer::InitPlayout() {
int OpenSLESPlayer::StartPlayout() {
ALOGD("StartPlayout%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(initialized_);
- DCHECK(!playing_);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(initialized_);
+ RTC_DCHECK(!playing_);
// The number of lower latency audio players is limited, hence we create the
// audio player in Start() and destroy it in Stop().
CreateAudioPlayer();
@@ -118,13 +118,13 @@ int OpenSLESPlayer::StartPlayout() {
// state, adding buffers will implicitly start playback.
RETURN_ON_ERROR((*player_)->SetPlayState(player_, SL_PLAYSTATE_PLAYING), -1);
playing_ = (GetPlayState() == SL_PLAYSTATE_PLAYING);
- DCHECK(playing_);
+ RTC_DCHECK(playing_);
return 0;
}
int OpenSLESPlayer::StopPlayout() {
ALOGD("StopPlayout%s", GetThreadInfo().c_str());
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if (!initialized_ || !playing_) {
return 0;
}
@@ -136,8 +136,8 @@ int OpenSLESPlayer::StopPlayout() {
// Verify that the buffer queue is in fact cleared as it should.
SLAndroidSimpleBufferQueueState buffer_queue_state;
(*simple_buffer_queue_)->GetState(simple_buffer_queue_, &buffer_queue_state);
- DCHECK_EQ(0u, buffer_queue_state.count);
- DCHECK_EQ(0u, buffer_queue_state.index);
+ RTC_DCHECK_EQ(0u, buffer_queue_state.count);
+ RTC_DCHECK_EQ(0u, buffer_queue_state.index);
#endif
// The number of lower latency audio players is limited, hence we create the
// audio player in Start() and destroy it in Stop().
@@ -171,7 +171,7 @@ int OpenSLESPlayer::SpeakerVolume(uint32_t& volume) const {
void OpenSLESPlayer::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
ALOGD("AttachAudioBuffer");
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
audio_device_buffer_ = audioBuffer;
const int sample_rate_hz = audio_parameters_.sample_rate();
ALOGD("SetPlayoutSampleRate(%d)", sample_rate_hz);
@@ -179,7 +179,7 @@ void OpenSLESPlayer::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
const int channels = audio_parameters_.channels();
ALOGD("SetPlayoutChannels(%d)", channels);
audio_device_buffer_->SetPlayoutChannels(channels);
- CHECK(audio_device_buffer_);
+ RTC_CHECK(audio_device_buffer_);
AllocateDataBuffers();
}
@@ -188,7 +188,7 @@ SLDataFormat_PCM OpenSLESPlayer::CreatePCMConfiguration(
int sample_rate,
size_t bits_per_sample) {
ALOGD("CreatePCMConfiguration");
- CHECK_EQ(bits_per_sample, SL_PCMSAMPLEFORMAT_FIXED_16);
+ RTC_CHECK_EQ(bits_per_sample, SL_PCMSAMPLEFORMAT_FIXED_16);
SLDataFormat_PCM format;
format.formatType = SL_DATAFORMAT_PCM;
format.numChannels = static_cast<SLuint32>(channels);
@@ -213,7 +213,7 @@ SLDataFormat_PCM OpenSLESPlayer::CreatePCMConfiguration(
format.samplesPerSec = SL_SAMPLINGRATE_48;
break;
default:
- CHECK(false) << "Unsupported sample rate: " << sample_rate;
+ RTC_CHECK(false) << "Unsupported sample rate: " << sample_rate;
}
format.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
format.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16;
@@ -223,15 +223,16 @@ SLDataFormat_PCM OpenSLESPlayer::CreatePCMConfiguration(
else if (format.numChannels == 2)
format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
else
- CHECK(false) << "Unsupported number of channels: " << format.numChannels;
+ RTC_CHECK(false) << "Unsupported number of channels: "
+ << format.numChannels;
return format;
}
void OpenSLESPlayer::AllocateDataBuffers() {
ALOGD("AllocateDataBuffers");
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!simple_buffer_queue_);
- CHECK(audio_device_buffer_);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(!simple_buffer_queue_);
+ RTC_CHECK(audio_device_buffer_);
bytes_per_buffer_ = audio_parameters_.GetBytesPerBuffer();
ALOGD("native buffer size: %" PRIuS, bytes_per_buffer_);
// Create a modified audio buffer class which allows us to ask for any number
@@ -252,10 +253,10 @@ void OpenSLESPlayer::AllocateDataBuffers() {
bool OpenSLESPlayer::CreateEngine() {
ALOGD("CreateEngine");
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if (engine_object_.Get())
return true;
- DCHECK(!engine_);
+ RTC_DCHECK(!engine_);
const SLEngineOption option[] = {
{SL_ENGINEOPTION_THREADSAFE, static_cast<SLuint32>(SL_BOOLEAN_TRUE)}};
RETURN_ON_ERROR(
@@ -271,7 +272,7 @@ bool OpenSLESPlayer::CreateEngine() {
void OpenSLESPlayer::DestroyEngine() {
ALOGD("DestroyEngine");
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if (!engine_object_.Get())
return;
engine_ = nullptr;
@@ -280,8 +281,8 @@ void OpenSLESPlayer::DestroyEngine() {
bool OpenSLESPlayer::CreateMix() {
ALOGD("CreateMix");
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(engine_);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(engine_);
if (output_mix_.Get())
return true;
@@ -296,7 +297,7 @@ bool OpenSLESPlayer::CreateMix() {
void OpenSLESPlayer::DestroyMix() {
ALOGD("DestroyMix");
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if (!output_mix_.Get())
return;
output_mix_.Reset();
@@ -304,14 +305,14 @@ void OpenSLESPlayer::DestroyMix() {
bool OpenSLESPlayer::CreateAudioPlayer() {
ALOGD("CreateAudioPlayer");
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(engine_object_.Get());
- DCHECK(output_mix_.Get());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(engine_object_.Get());
+ RTC_DCHECK(output_mix_.Get());
if (player_object_.Get())
return true;
- DCHECK(!player_);
- DCHECK(!simple_buffer_queue_);
- DCHECK(!volume_);
+ RTC_DCHECK(!player_);
+ RTC_DCHECK(!simple_buffer_queue_);
+ RTC_DCHECK(!volume_);
// source: Android Simple Buffer Queue Data Locator is source.
SLDataLocator_AndroidSimpleBufferQueue simple_buffer_queue = {
@@ -389,7 +390,7 @@ bool OpenSLESPlayer::CreateAudioPlayer() {
void OpenSLESPlayer::DestroyAudioPlayer() {
ALOGD("DestroyAudioPlayer");
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if (!player_object_.Get())
return;
player_object_.Reset();
@@ -407,7 +408,7 @@ void OpenSLESPlayer::SimpleBufferQueueCallback(
}
void OpenSLESPlayer::FillBufferQueue() {
- DCHECK(thread_checker_opensles_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_opensles_.CalledOnValidThread());
SLuint32 state = GetPlayState();
if (state != SL_PLAYSTATE_PLAYING) {
ALOGW("Buffer callback in non-playing state!");
@@ -433,7 +434,7 @@ void OpenSLESPlayer::EnqueuePlayoutData() {
}
SLuint32 OpenSLESPlayer::GetPlayState() const {
- DCHECK(player_);
+ RTC_DCHECK(player_);
SLuint32 state;
SLresult err = (*player_)->GetPlayState(player_, &state);
if (SL_RESULT_SUCCESS != err) {
« no previous file with comments | « webrtc/modules/audio_device/android/opensles_player.h ('k') | webrtc/modules/audio_device/fine_audio_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698