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

Commit d4f1d131 authored by Krishnankutty Kolathappilly's avatar Krishnankutty Kolathappilly
Browse files

hal : Send drain to the driver if next track returns error

-Partial drain is send to the driver after next track ioctl.
-If next track times out or returns any error then call drain.
-Partial drain will not  be executed if next track fails.

CRs-Fixed: 594977
Change-Id: I0665f21a5ea01f7776408b5155344f542021c299
parent 60d65d1d
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -831,6 +831,7 @@ static void *offload_thread_loop(void *context)
{
{
    struct stream_out *out = (struct stream_out *) context;
    struct stream_out *out = (struct stream_out *) context;
    struct listnode *item;
    struct listnode *item;
    int ret = 0;


    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
    set_sched_policy(0, SP_FOREGROUND);
    set_sched_policy(0, SP_FOREGROUND);
@@ -880,8 +881,14 @@ static void *offload_thread_loop(void *context)
            event = STREAM_CBK_EVENT_WRITE_READY;
            event = STREAM_CBK_EVENT_WRITE_READY;
            break;
            break;
        case OFFLOAD_CMD_PARTIAL_DRAIN:
        case OFFLOAD_CMD_PARTIAL_DRAIN:
            compress_next_track(out->compr);
            ret = compress_next_track(out->compr);
            if(ret == 0)
                compress_partial_drain(out->compr);
                compress_partial_drain(out->compr);
            else if(ret == -ETIMEDOUT)
                compress_drain(out->compr);
            else
                ALOGE("%s: Next track returned error %d",__func__, ret);

            send_callback = true;
            send_callback = true;
            event = STREAM_CBK_EVENT_DRAIN_READY;
            event = STREAM_CBK_EVENT_DRAIN_READY;
            break;
            break;