Formerly, if an AudioRecord::read() got a timeout on obtainBuffer()
after already successfully transferring some data, then it returned zero.
This had the effect of discarding a partial transfer, which resulted in
a gap in the audio data delivered to the app. Now if a timeout occurs
after a partial transfer, it returns that partial transfer count so that
no data is lost.
Change-Id: I0d9c2f4e495a400b56ef916a06613ba26537ca97
break;
}
if (err == status_t(TIMED_OUT)) {
- err = 0;
+ // return partial transfer count
+ return read;
}
return ssize_t(err);
}