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

Commit 028cf152 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qahw: test: Add changes to support a2dp source playback"

parents fcb2f4f4 8acb9ff4
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -508,8 +508,6 @@ void *start_stream_playback (void* stream_data)
    pthread_t drift_query_thread;
    struct drift_data drift_params;

    if (params->output_device & AUDIO_DEVICE_OUT_ALL_A2DP)
        params->output_device = AUDIO_DEVICE_OUT_PROXY;
    rc = qahw_open_output_stream(params->qahw_out_hal_handle,
                             params->handle,
                             params->output_device,
@@ -1403,10 +1401,13 @@ void usage() {
    printf(" hal_play_test -f /data/MateRani.mp3 -t 2 -d 2 -v 0.01 -r 44100 -c 2 \n");
    printf("                                          -> plays MP3 stream(-t = 2) on speaker device(-d = 2)\n");
    printf("                                          -> 2 channels and 44100 sample rate\n\n");
    printf(" hal_play_test -f /data/v1-CBR-32kHz-stereo-40kbps.mp3 -t 2 -d 128 -v 0.01 -r 32000 -c 2 -D /data/proxy_dump.wav\n");
    printf("                                          -> plays MP3 stream(-t = 2) on BT device(-d = 128)\n");
    printf(" hal_play_test -f /data/v1-CBR-32kHz-stereo-40kbps.mp3 -t 2 -d 33554432 -v 0.01 -r 32000 -c 2 -D /data/proxy_dump.wav\n");
    printf("                                          -> plays MP3 stream(-t = 2) on BT device in non-split path (-d = 33554432)\n");
    printf("                                          -> 2 channels and 32000 sample rate\n");
    printf("                                          -> dumps pcm data to file at /data/proxy_dump.wav\n\n");
    printf(" hal_play_test -f /data/v1-CBR-32kHz-stereo-40kbps.mp3 -t 2 -d 128 -v 0.01 -r 32000 -c 2 \n");
    printf("                                          -> plays MP3 stream(-t = 2) on BT device in split path (-d = 128)\n");
    printf("                                          -> 2 channels and 32000 sample rate\n");
    printf(" hal_play_test -f /data/AACLC-71-48000Hz-384000bps.aac  -t 4 -d 2 -v 0.05 -r 48000 -c 2 -a 1 \n");
    printf("                                          -> plays AAC-ADTS stream(-t = 4) on speaker device(-d = 2)\n");
    printf("                                          -> AAC format type is LC(-a = 1)\n");
@@ -1756,7 +1757,7 @@ int main(int argc, char* argv[]) {
        goto exit;
    }

    if (num_of_streams > 1 && stream_param[num_of_streams-1].output_device & AUDIO_DEVICE_OUT_ALL_A2DP) {
    if (num_of_streams > 1 && stream_param[num_of_streams-1].output_device & AUDIO_DEVICE_OUT_PROXY) {
        fprintf(log_file, "Proxy thread is not supported for multi-playback usecase\n");
        fprintf(stderr, "Proxy thread is not supported for multi-playback usecase\n");
        goto exit;
@@ -1827,13 +1828,14 @@ int main(int argc, char* argv[]) {
        } else if (kpi_mode == true)
            stream->config.format = stream->config.offload_info.format = AUDIO_FORMAT_PCM_16_BIT;

        if (stream->output_device & AUDIO_DEVICE_OUT_ALL_A2DP)
        if (stream->output_device & AUDIO_DEVICE_OUT_PROXY)
            fprintf(log_file, "Saving pcm data to file: %s\n", proxy_params.acp.file_name);

        /* Set device connection state for HDMI */
        if (stream->output_device == AUDIO_DEVICE_OUT_AUX_DIGITAL) {
        if ((stream->output_device == AUDIO_DEVICE_OUT_AUX_DIGITAL) ||
            (stream->output_device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP)) {
            char param[100] = {0};
            snprintf(param, sizeof(param), "%s=%d", "connect", AUDIO_DEVICE_OUT_AUX_DIGITAL);
            snprintf(param, sizeof(param), "%s=%d", "connect", stream->output_device);
            qahw_set_parameters(stream->qahw_out_hal_handle, param);
        }

@@ -1892,9 +1894,10 @@ exit:
     * reset device connection state for HDMI and close the file streams
     */
     for (i = 0; i < num_of_streams; i++) {
         if (stream_param[i].output_device == AUDIO_DEVICE_OUT_AUX_DIGITAL) {
         if ((stream_param[i].output_device == AUDIO_DEVICE_OUT_AUX_DIGITAL) ||
             (stream_param[i].output_device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP)) {
             char param[100] = {0};
             snprintf(param, sizeof(param), "%s=%d", "disconnect", AUDIO_DEVICE_OUT_AUX_DIGITAL);
             snprintf(param, sizeof(param), "%s=%d", "disconnect", stream_param[i].output_device);
             qahw_set_parameters(stream_param[i].qahw_out_hal_handle, param);
         }