OPEN SL ES Application crashing when trying to queue someone else's audio (streaming audio)

60 views Asked by At

I'm trying to record audio and play it in real time using OpenSL ES, I can send the audio packet to the server, and the server is sending the packet to users correctly. However, there is a problem that I don't know why. The user who is recording can hear himself (the audio goes through the server and goes back to him), but when another user is speaking, the audio packages arrive and when I will queue the application closes.

Here is the part where I play the audio packets that arrive from the server.

    {
        (*playerBufferQueueItf)->Enqueue(playerBufferQueueItf, buffer, bufferSize); // Crash Here
    }

Below starts the listen

        createEngine();

    // Create a mixer
    SLresult result;
    result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObjext, 0, 0, 0);
    assert(SL_RESULT_SUCCESS == result);
    (void)result;

    result = (*outputMixObjext)->Realize(outputMixObjext, SL_BOOLEAN_FALSE);
    assert(SL_RESULT_SUCCESS == result);
    (void)result;

    // Create a player
    createAudioPlayer(engineEngine, outputMixObjext, playerObject);

    result = (*playerObject)->Realize(playerObject, SL_BOOLEAN_FALSE);
    assert(SL_RESULT_SUCCESS == result);
    (void)result;


     result = (*playerObject)->GetInterface(playerObject, SL_IID_BUFFERQUEUE, &playerBufferQueueItf);
     assert(SL_RESULT_SUCCESS == result);
     (void)result;

    result = (*playerObject)->GetInterface(playerObject, SL_IID_PLAY, &playerPlay);
    assert(SL_RESULT_SUCCESS == result);
    (void)result;

    result = (*playerPlay)->SetPlayState(playerPlay, SL_PLAYSTATE_PLAYING);
    assert(SL_RESULT_SUCCESS == result); ```
0

There are 0 answers