Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 559e3bce authored by Geoffrey Pitsch's avatar Geoffrey Pitsch Committed by android-build-merger
Browse files

Merge \\"Play boot sound on the System stream.\\" into nyc-mr1-dev am: 7d2f4cc7

am: bbb9d56a

Change-Id: I7286ca72cb20fa4f0339caff22ca50cd7564d43e
parents b20f4f0e bbb9d56a
Loading
Loading
Loading
Loading
+19 −3
Original line number Original line Diff line number Diff line
@@ -158,16 +158,32 @@ bool createBufferQueueAudioPlayer(const ChunkFormat* chunkFormat) {
    SLDataSink audioSnk = {&loc_outmix, NULL};
    SLDataSink audioSnk = {&loc_outmix, NULL};


    // create audio player
    // create audio player
    const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
    const SLInterfaceID ids[3] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME, SL_IID_ANDROIDCONFIGURATION};
    const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
    const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
    result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk,
    result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk,
            2, ids, req);
            3, ids, req);
    if (result != SL_RESULT_SUCCESS) {
    if (result != SL_RESULT_SUCCESS) {
        ALOGE("sl CreateAudioPlayer failed with result %d", result);
        ALOGE("sl CreateAudioPlayer failed with result %d", result);
        return false;
        return false;
    }
    }
    (void)result;
    (void)result;


    // Use the System stream for boot sound playback.
    SLAndroidConfigurationItf playerConfig;
    result = (*bqPlayerObject)->GetInterface(bqPlayerObject,
        SL_IID_ANDROIDCONFIGURATION, &playerConfig);
    if (result != SL_RESULT_SUCCESS) {
        ALOGE("config GetInterface failed with result %d", result);
        return false;
    }
    SLint32 streamType = SL_ANDROID_STREAM_SYSTEM;
    result = (*playerConfig)->SetConfiguration(playerConfig,
        SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(SLint32));
    if (result != SL_RESULT_SUCCESS) {
        ALOGE("SetConfiguration failed with result %d", result);
        return false;
    }

    // realize the player
    // realize the player
    result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
    result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
    if (result != SL_RESULT_SUCCESS) {
    if (result != SL_RESULT_SUCCESS) {