Audioflinger intercept track retry on buffer end
Track::interceptBuffer failed to write all the audio if the source BP
could not returned the requested buffer size.
This is actually normal when the source circular buffer wraps around.
Handle it by retrying if the first buffer is too small.
Test: adb shell audiorecorder --target /data/file.raw
Bug: 111453086
Change-Id: I42a7962449a0f075909a29f5f8f5ba82ca1d0085
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index 3f62bc3..94ea042 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -222,6 +222,8 @@
private:
void interceptBuffer(const AudioBufferProvider::Buffer& buffer);
+ /** Write the source data in the buffer provider. @return written frame count. */
+ size_t writeFrames(AudioBufferProvider* dest, const void* src, size_t frameCount);
template <class F>
void forEachTeePatchTrack(F f) {
for (auto& tp : mTeePatches) { f(tp.patchTrack); }