Record phone calls using OpenSL ES

245 views
Skip to first unread message

Milow

unread,
Feb 16, 2016, 2:22:37 PM2/16/16
to android-ndk


I am trying to record phone calls on my Motorola Moto G, however, my phone does not support VOICE_CALL source for the Java method (I get one side of the call).

recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

I have also written an OpenSL ES code (which I adapted from the Echo example from Google) but again I can only get the default MIC input!  I have played with options here but it seems it is doomed to a crash and Google say it "must be this";

SLDataLocator_IODevice loc_dev = {SL_DATALOCATOR_IODEVICE,
SL_IODEVICE_AUDIOINPUT,
SL_DEFAULTDEVICEID_AUDIOINPUT,
NULL };
SLDataSource audioSrc = {&loc_dev, NULL };

I have tried two other commercial apps both of which seem to be able to record on my phone, what method are they using?

Rafał Depta

unread,
Jan 11, 2017, 10:28:32 AM1/11/17
to android-ndk
I stuck on same problem, did you find solution?

Sridhar Ananthakrishnan

unread,
Apr 11, 2017, 1:52:34 PM4/11/17
to android-ndk
Hi Milow,

If you are using OpenSLES for recording, then you no need to use MediaRecorder. If you have logs for this. Please post the log details. I will help you out in this.

Regards,
SA
Reply all
Reply to author
Forward
0 new messages