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

Commit b9012ab5 authored by Haynes Mathew George's avatar Haynes Mathew George
Browse files

audio: Re-arrange member var initializations

Rearrange initializations of some stream_out member
variables to prevent possible uninitialized use.

CRs-Fixed: 587676
Change-Id: I7018f38f29a19b130185b285f4acf22219e4228c
parent ddad8611
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -857,9 +857,6 @@ static void *offload_thread_loop(void *context)
    struct stream_out *out = (struct stream_out *) context;
    struct listnode *item;

    out->offload_state = OFFLOAD_STATE_IDLE;
    out->playback_started = 0;

    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
    set_sched_policy(0, SP_FOREGROUND);
    prctl(PR_SET_NAME, (unsigned long)"Offload Callback", 0, 0, 0);
@@ -2001,6 +1998,13 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
    *stream_out = NULL;
    out = (struct stream_out *)calloc(1, sizeof(struct stream_out));

    if (!out) {
        return -ENOMEM;
    }

    pthread_mutex_init(&out->lock, (const pthread_mutexattr_t *) NULL);
    pthread_cond_init(&out->cond, (const pthread_condattr_t *) NULL);

    if (devices == AUDIO_DEVICE_NONE)
        devices = AUDIO_DEVICE_OUT_SPEAKER;

@@ -2094,6 +2098,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
            out->non_blocking = 1;

        out->send_new_metadata = 1;
        out->offload_state = OFFLOAD_STATE_IDLE;
        out->playback_started = 0;

        create_offload_callback_thread(out);
        ALOGV("%s: offloaded output offload_info version %04x bit rate %d",
                __func__, config->offload_info.version,
@@ -2168,9 +2175,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
    /* out->muted = false; by calloc() */
    /* out->written = 0; by calloc() */

    pthread_mutex_init(&out->lock, (const pthread_mutexattr_t *) NULL);
    pthread_cond_init(&out->cond, (const pthread_condattr_t *) NULL);

    config->format = out->stream.common.get_format(&out->stream.common);
    config->channel_mask = out->stream.common.get_channels(&out->stream.common);
    config->sample_rate = out->stream.common.get_sample_rate(&out->stream.common);