On Jul 23, 3:45 pm, "amr.has" <nourha...@hotmail.com> wrote: > so the problem is in change SND_PCM_STREAM_CAPTUR by > SND_PCM_STREAM_PLAYBACK ?? > > can u explain more details about this solution
I hadn't found the solution at the time; I've found it recently. In "openInputStream" method (donut branch version) in AudioHardwareALSA.cpp the handle acquired is wrong. The code looks for the second and last object of mDeviceList, but does it in the wrong way: it gets the "end()" iterator which is AFTER the last element (check frameworks/base/include/utils/List.h for reference). The solution is to get the element after the first like in this patch: http://pastebin.com/zHAgvq26 After this change Android should try to open AndroidCapture, look in the log for: I/ALSAModule( 1788): Initialized ALSA CAPTURE device default Next problem I get (yeah, not finished yet!) is a "buffer overflow" issue in AudioFlinger which prevents audio recording to succeed. Inspecting the code I found out that disabling the second condition of the if in "AudioFlinger::AudioRecordThread::threadLoop" in AudioFlinger.cpp makes the recording work correctly. You can take a look at the code at this link: http://tinyurl.com/3bbmnal The condition that sometimes fails is "(int)buffer.frameCount == inFrameCount" because, if I have buffer size set to 2048 I sometimes get buffer.frameCount equal to 64. In particular, like in this log: http://pastebin.com/dQgDaTQL I get two times 2048 and one time 64 (then it starts again). I've tried setting buffer size to 320 as suggested in several places, which seems to be a proper value because ((2048 * 2) + 64) / 320 = 13, but it gets rounded to 256 because of this code: http://tinyurl.com/4ypemob I'm going to investigate further, but does anybody know what's the best solution (removing the rounding code?) and explain a bit better what I'm doing? Thanks, Diego -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting