hal: return error if write fails

An error code is returned if there is any failure in
out_write() API in the case of passthrough streams.
This change is needed to handle the error scenarios
properly in the application.

Change-Id: I760cb9342291490f0bf1fb61e196d57558c09fb5
This commit is contained in:
Vidyakumar Athota 2017-08-09 12:13:05 -07:00 committed by Garmond Leung
parent a00ef46c36
commit a9d3a5fa86
2 changed files with 6 additions and 1 deletions

View File

@ -3944,6 +3944,11 @@ exit:
if (!(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)) if (!(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD))
usleep((uint64_t)bytes * 1000000 / audio_stream_out_frame_size(stream) / usleep((uint64_t)bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate(&out->stream.common)); out_get_sample_rate(&out->stream.common));
if (audio_extn_passthru_is_passthrough_stream(out)) {
ALOGE("%s: write error, ret = %d", __func__, ret);
return ret;
}
} }
return bytes; return bytes;
} }

View File

@ -563,7 +563,7 @@ void *start_stream_playback (void* stream_data)
size_t bytes_wanted = 0; size_t bytes_wanted = 0;
size_t write_length = 0; size_t write_length = 0;
size_t bytes_remaining = 0; size_t bytes_remaining = 0;
size_t bytes_written = 0; ssize_t bytes_written = 0;
size_t bytes_read = 0; size_t bytes_read = 0;
char *data_ptr = NULL; char *data_ptr = NULL;