The solution is a patch for AudioHardware.cpp. It dumps the PCM samples in a data file before they are passed on to Kernel drivers (to ADSP).
To start collecting the logs, we need to push an empty file, dump.pcm to /data directory. Example, ' adb push dump.pcm /data/dump.pcm'
To play the PCM logs, we would need to know the sampling rate and number of channels being used. With this information, we can play the PCM files using some player, such as Goldwave.
Please study the following patch prepared for android donut (similar should apply on cupcake and éclairs). It is a little inefficient, becuase it opens dump.pcm file each time, we want to make a new write.
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index bef2178..279b2ef 100755
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -1418,10 +1418,19 @@ Error:
ssize_t AudioHardware::AudioStreamOutMSM72xx::write(const void* buffer, size_t bytes)
{
// LOGE("AudioStreamOutMSM72xx::write(%p, %u)", buffer, bytes);
+ int tmpFd;
size_t count = bytes;
const uint8_t* p = static_cast<const uint8_t*>(buffer);
+ tmpFd = ::open("/data/dump.pcm", O_WRONLY | O_APPEND );
+ if ( tmpFd < 0 ) {
+ LOGE("No dump file");
+ } else {
+ ::write(tmpFd, p, count);
+ ::close(tmpFd);
+ }
+
while (count) {
ssize_t written = ::write(mFd, p, count);
if (written >= 0) {
No comments:
Post a Comment