OSDN Git Service

Fix several test-resample BufferProvider bugs
authorGlenn Kasten <gkasten@google.com>
Tue, 17 Dec 2013 21:54:29 +0000 (13:54 -0800)
committerGlenn Kasten <gkasten@google.com>
Tue, 17 Dec 2013 22:13:54 +0000 (14:13 -0800)
commite00eefe64e3bad166c672db96c9c35992766e819
treee2645cbcb92fc6b4ccdb2075323309f6f22196fc
parente175e5ec1636fc638465187f3d5c6166d92388ed
Fix several test-resample BufferProvider bugs

Previously getNextBuffer always returned the same data address over
and over.  Now it correctly returns the right portion of the input buffer.

Previously getNextBuffer always returned the total number of frames in
the input, which might be larger than the size requested by the caller,
and/or larger than the number of remaining input frames.  It also always
returned successfully, even when there should be no frames available.
This violates the contract for getNextBuffer.  Now getNextBuffer will
return the maximum of the number of frames requested, and the number of
remaining frames available.  If that maximum is zero, getNextBuffer will
return an error instead.

Previously releaseBuffer would silently allow releasing more frames than
were actually gotten, which violates the contract for releaseBuffer.
Now releaseBuffer checks for this and logs a message if it happens.

Add 'v' (verbose) option to log buffer provider calls.

Bug: 12194314
Change-Id: I9b915e954b3612a07ef271da8652486b8875e0fd
services/audioflinger/test-resample.cpp