Buffering URI on OpenSL, Android

I have been trying OpenSL for several weeks. I am trying to access the buffer while playing a file on the SD card through SL_DATALOCATOR_URI as the source. I want to write some of my own effects and need a buffer.

I am currently creating two audio players in the code. One reads the file into the buffer, the other writes the buffer to the output. When I test the code with a microphone (recorder), everything is fine. The audio input works as expected.

When I switch the recorder using the uri audio player, the queue goes into haywire mode. Streaming does not listen for thread blocking (this happens as asynchronously, as I understand it), and buffer calls do not start correctly, time flies.

I put the logs for each method, so the result looks something like this:

V/PDecoder( 1292): Position : 15023
V/PDecoder( 1292): Position : 16044
V/PDecoder( 1292): Position : 17043
V/PDecoder Native PL1( 1292): bqPlayerCallback
V/PDecoder Native PL1( 1292): Notify thread lock
V/PDecoder Native PL1( 1292): android_AudioIn 32768
V/PDecoder Native PL1( 1292): Wait thread lock
V/PDecoder Native PL1( 1292): android_AudioOut 32768
V/PDecoder Native PL1( 1292): android_AudioIn 32768
V/PDecoder Native PL1( 1292): android_AudioOut 32768
V/PDecoder Native PL1( 1292): Wait thread lock
V/PDecoder Native PL1( 1292): bqRecorderCallback
V/PDecoder Native PL1( 1292): Notify thread lock
V/PDecoder( 1708): Position : 18041
V/PDecoder( 1708): Position : 19040
V/PDecoder( 1708): Position : 20038

, .

, , ? audioplayer > buffer > output uri? ? - , .

,

0
3

, , , .

, - . . URL-, , java, gui.

PS. , , , . , , , . , .

Bonus. java ( * env, java-). , JNI_OnLoad, playStatusCallback() callPositionChanged() .

,

+1

, , . :

http://audioprograming.wordpress.com/2012/10/29/lock-free-audio-io-with-opensl-es-on-android/

:

http://audioprograming.wordpress.com/2012/03/03/android-audio-streaming-with-opensl-es-and-the-ndk/

, , , h c, openl, opensl_io. , opensl_example, inbuffer outbuffer . , inbuffer opensl_example, outbuffer , , . , , .

, , , - , . SLDATA_locator URI utf8, , , .

, , , , . mp3. , , . , , SWIG. JNI, .

, ? StartPDecoderNative, DecodeOn Java uri ?

0

, c h java, .

, , positionchanged java. ? jmethod, , . ?

, , , ? outbuffer? , , fft , outbuffer, ?

0

Source: https://habr.com/ru/post/1525406/


All Articles