Logs use either %#x or 0x%x for flags, channel mask, format, device

Preferred is %#x but 0x%x is also permitted because it is widely used.

The benefit is that it reduces ambiguity and possible confusion,
without needing to read the source code for each log.

Test: builds OK and logs are less ambiguous
Change-Id: Ie2404e071d22278b8bba1e094ad336887844212c
gugelfrei
Glenn Kasten 7 years ago
parent b3ded70210
commit 49f36ba3b4

@ -631,7 +631,7 @@ status_t AudioSystem::AudioFlingerClient::getInputBufferSize(
|| (channelMask != mInChannelMask)) { || (channelMask != mInChannelMask)) {
size_t inBuffSize = af->getInputBufferSize(sampleRate, format, channelMask); size_t inBuffSize = af->getInputBufferSize(sampleRate, format, channelMask);
if (inBuffSize == 0) { if (inBuffSize == 0) {
ALOGE("AudioSystem::getInputBufferSize failed sampleRate %d format %#x channelMask %x", ALOGE("AudioSystem::getInputBufferSize failed sampleRate %d format %#x channelMask %#x",
sampleRate, format, channelMask); sampleRate, format, channelMask);
return BAD_VALUE; return BAD_VALUE;
} }

@ -2674,13 +2674,13 @@ status_t AudioTrack::dump(int fd, const Vector<String16>& args __unused) const
String8 result; String8 result;
result.append(" AudioTrack::dump\n"); result.append(" AudioTrack::dump\n");
result.appendFormat(" status(%d), state(%d), session Id(%d), flags(%x)\n", result.appendFormat(" status(%d), state(%d), session Id(%d), flags(%#x)\n",
mStatus, mState, mSessionId, mFlags); mStatus, mState, mSessionId, mFlags);
result.appendFormat(" stream type(%d), left - right volume(%f, %f)\n", result.appendFormat(" stream type(%d), left - right volume(%f, %f)\n",
(mStreamType == AUDIO_STREAM_DEFAULT) ? (mStreamType == AUDIO_STREAM_DEFAULT) ?
audio_attributes_to_stream_type(&mAttributes) : mStreamType, audio_attributes_to_stream_type(&mAttributes) : mStreamType,
mVolume[AUDIO_INTERLEAVE_LEFT], mVolume[AUDIO_INTERLEAVE_RIGHT]); mVolume[AUDIO_INTERLEAVE_LEFT], mVolume[AUDIO_INTERLEAVE_RIGHT]);
result.appendFormat(" format(%x), channel mask(%x), channel count(%u)\n", result.appendFormat(" format(%#x), channel mask(%#x), channel count(%u)\n",
mFormat, mChannelMask, mChannelCount); mFormat, mChannelMask, mChannelCount);
result.appendFormat(" sample rate(%u), original sample rate(%u), speed(%f)\n", result.appendFormat(" sample rate(%u), original sample rate(%u), speed(%f)\n",
mSampleRate, mOriginalSampleRate, mPlaybackRate.mSpeed); mSampleRate, mOriginalSampleRate, mPlaybackRate.mSpeed);

@ -2042,8 +2042,8 @@ status_t AudioFlinger::openOutput(audio_module_handle_t module,
uint32_t *latencyMs, uint32_t *latencyMs,
audio_output_flags_t flags) audio_output_flags_t flags)
{ {
ALOGI("openOutput() this %p, module %d Device %x, SamplingRate %d, Format %#08x, Channels %x, " ALOGI("openOutput() this %p, module %d Device %#x, SamplingRate %d, Format %#08x, "
"flags %x", "Channels %#x, flags %#x",
this, module, this, module,
(devices != NULL) ? *devices : 0, (devices != NULL) ? *devices : 0,
config->sample_rate, config->sample_rate,
@ -2285,8 +2285,8 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openInput_l(audio_module_handle_t mod
sp<StreamInHalInterface> inStream; sp<StreamInHalInterface> inStream;
status_t status = inHwHal->openInputStream( status_t status = inHwHal->openInputStream(
*input, devices, &halconfig, flags, address.string(), source, &inStream); *input, devices, &halconfig, flags, address.string(), source, &inStream);
ALOGV("openInput_l() openInputStream returned input %p, devices %x, SamplingRate %d" ALOGV("openInput_l() openInputStream returned input %p, devices %#x, SamplingRate %d"
", Format %#x, Channels %x, flags %#x, status %d addr %s", ", Format %#x, Channels %#x, flags %#x, status %d addr %s",
inStream.get(), inStream.get(),
devices, devices,
halconfig.sample_rate, halconfig.sample_rate,

@ -121,7 +121,7 @@ BufLogStream::BufLogStream(unsigned int id,
} else { } else {
mTag[0] = 0; mTag[0] = 0;
} }
ALOGV("Creating BufLogStream id:%d tag:%s format:%d ch:%d sr:%d maxbytes:%zu", mId, mTag, ALOGV("Creating BufLogStream id:%d tag:%s format:%#x ch:%d sr:%d maxbytes:%zu", mId, mTag,
mFormat, mChannels, mSamplingRate, mMaxBytes); mFormat, mChannels, mSamplingRate, mMaxBytes);
//open file (s), info about tag, format, etc. //open file (s), info about tag, format, etc.

@ -1412,7 +1412,7 @@ status_t AudioFlinger::ThreadBase::addEffect_l(const sp<EffectModule>& effect)
bool chainCreated = false; bool chainCreated = false;
ALOGD_IF((mType == OFFLOAD) && !effect->isOffloadable(), ALOGD_IF((mType == OFFLOAD) && !effect->isOffloadable(),
"addEffect_l() on offloaded thread %p: effect %s does not support offload flags %x", "addEffect_l() on offloaded thread %p: effect %s does not support offload flags %#x",
this, effect->desc().name, effect->desc().flags); this, effect->desc().name, effect->desc().flags);
if (chain == 0) { if (chain == 0) {
@ -3697,7 +3697,7 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
// mNormalSink below // mNormalSink below
{ {
ALOGV("MixerThread() id=%d device=%#x type=%d", id, device, type); ALOGV("MixerThread() id=%d device=%#x type=%d", id, device, type);
ALOGV("mSampleRate=%u, mChannelMask=%#x, mChannelCount=%u, mFormat=%d, mFrameSize=%zu, " ALOGV("mSampleRate=%u, mChannelMask=%#x, mChannelCount=%u, mFormat=%#x, mFrameSize=%zu, "
"mFrameCount=%zu, mNormalFrameCount=%zu", "mFrameCount=%zu, mNormalFrameCount=%zu",
mSampleRate, mChannelMask, mChannelCount, mFormat, mFrameSize, mFrameCount, mSampleRate, mChannelMask, mChannelCount, mFormat, mFrameSize, mFrameCount,
mNormalFrameCount); mNormalFrameCount);
@ -3765,7 +3765,7 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
NBAIO_Format origformat = format; NBAIO_Format origformat = format;
#endif #endif
// adjust format to match that of the Fast Mixer // adjust format to match that of the Fast Mixer
ALOGV("format changed from %d to %d", format.mFormat, fastMixerFormat); ALOGV("format changed from %#x to %#x", format.mFormat, fastMixerFormat);
format.mFormat = fastMixerFormat; format.mFormat = fastMixerFormat;
format.mFrameSize = audio_bytes_per_sample(format.mFormat) * format.mChannelCount; format.mFrameSize = audio_bytes_per_sample(format.mFormat) * format.mChannelCount;

@ -804,7 +804,8 @@ status_t AudioPolicyManager::getOutputForAttr(const audio_attributes_t *attr,
flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_HW_AV_SYNC); flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_HW_AV_SYNC);
} }
ALOGV("getOutputForAttr() device 0x%x, sampling rate %d, format %x, channel mask %x, flags %x", ALOGV("getOutputForAttr() device 0x%x, sampling rate %d, format %#x, channel mask %#x, "
"flags %#x",
device, config->sample_rate, config->format, config->channel_mask, flags); device, config->sample_rate, config->format, config->channel_mask, flags);
*output = getOutputForDevice(device, session, *stream, config, flags); *output = getOutputForDevice(device, session, *stream, config, flags);
@ -972,7 +973,7 @@ non_direct_output:
output = selectOutput(outputs, flags, config->format); output = selectOutput(outputs, flags, config->format);
} }
ALOGW_IF((output == 0), "getOutputForDevice() could not find output for stream %d, " ALOGW_IF((output == 0), "getOutputForDevice() could not find output for stream %d, "
"sampling rate %d, format %d, channels %x, flags %x", "sampling rate %d, format %#x, channels %#x, flags %#x",
stream, config->sample_rate, config->format, config->channel_mask, flags); stream, config->sample_rate, config->format, config->channel_mask, flags);
return output; return output;
@ -1401,7 +1402,7 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
input_type_t *inputType, input_type_t *inputType,
audio_port_handle_t *portId) audio_port_handle_t *portId)
{ {
ALOGV("getInputForAttr() source %d, sampling rate %d, format %d, channel mask %x," ALOGV("getInputForAttr() source %d, sampling rate %d, format %#x, channel mask %#x,"
"session %d, flags %#x", "session %d, flags %#x",
attr->source, config->sample_rate, config->format, config->channel_mask, session, flags); attr->source, config->sample_rate, config->format, config->channel_mask, session, flags);
@ -1705,7 +1706,7 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(audio_devices_t device,
!audio_formats_match(profileFormat, lConfig.format) || !audio_formats_match(profileFormat, lConfig.format) ||
(profileChannelMask != lConfig.channel_mask)) { (profileChannelMask != lConfig.channel_mask)) {
ALOGW("getInputForAttr() failed opening input: sampling rate %d" ALOGW("getInputForAttr() failed opening input: sampling rate %d"
", format %d, channel mask %x", ", format %#x, channel mask %#x",
profileSamplingRate, profileFormat, profileChannelMask); profileSamplingRate, profileFormat, profileChannelMask);
if (input != AUDIO_IO_HANDLE_NONE) { if (input != AUDIO_IO_HANDLE_NONE) {
inputDesc->close(); inputDesc->close();

Loading…
Cancel
Save