Merge "Update library paths for 64 bits" into nyc-dev
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 296aaab..a4ea34c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1724,8 +1724,10 @@
     if ((out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) && (dsp_frames != NULL)) {
         lock_output_stream(out);
         if (out->compr != NULL) {
-            compress_get_tstamp(out->compr, (unsigned long *)dsp_frames,
-                    &out->sample_rate);
+            unsigned long frames = 0;
+            // TODO: check return value
+            compress_get_tstamp(out->compr, &frames, &out->sample_rate);
+            *dsp_frames = (uint32_t)frames;
             ALOGVV("%s rendered frames %d sample_rate %d",
                    __func__, *dsp_frames, out->sample_rate);
         }
@@ -1757,13 +1759,14 @@
                                    uint64_t *frames, struct timespec *timestamp)
 {
     struct stream_out *out = (struct stream_out *)stream;
-    int ret = -1;
+    int ret = -EINVAL;
     unsigned long dsp_frames;
 
     lock_output_stream(out);
 
     if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) {
         if (out->compr != NULL) {
+            // TODO: check return value
             compress_get_tstamp(out->compr, &dsp_frames,
                     &out->sample_rate);
             ALOGVV("%s rendered frames %ld sample_rate %d",
@@ -2066,7 +2069,9 @@
         ALOGV("%s: read failed - sleeping for buffer duration", __func__);
         usleep(bytes * 1000000 / audio_stream_in_frame_size(stream) /
                in_get_sample_rate(&in->stream.common));
-    } else {
+        memset(buffer, 0, bytes); // clear return data
+    }
+    if (bytes > 0) {
         in->frames_read += bytes / audio_stream_in_frame_size(stream);
     }
     return bytes;