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

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

Merge "qahw: Add condition to check bytes written to hal"

parents 13388a25 906b39bd
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ void *proxy_read (void* data)
    qahw_in_buffer_t in_buf;
    char *buffer;
    int rc = 0;
    int bytes_to_read, bytes_written = 0;
    int bytes_to_read, bytes_written = 0, bytes_wrote = 0;
    FILE *fp = NULL;
    qahw_stream_handle_t* in_handle = nullptr;

@@ -416,7 +416,13 @@ void *proxy_read (void* data)
        while (!(params->acp.thread_exit)) {
            rc = qahw_in_read(in_handle, &in_buf);
            if (rc > 0) {
                bytes_written += fwrite((char *)(in_buf.buffer), sizeof(char), (int)in_buf.bytes, fp);
                bytes_wrote = fwrite((char *)(in_buf.buffer), sizeof(char), (int)in_buf.bytes, fp);
                bytes_written += bytes_wrote;
                if(bytes_wrote < in_buf.bytes) {
                   stop_playback = true;
                   fprintf(log_file, "Error in fwrite due to no memory(%d)=%s\n",ferror(fp), strerror(ferror(fp)));
                   break;
                }
            }
        }
        params->hdr.data_sz = bytes_written;