History log of /system/media/audio_utils/fifo.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8c5518ab1b5382bd047b5f16d8bd06e3c853705b 18-Apr-2017 Glenn Kasten <gkasten@google.com> Add option to flush the entire buffer on -EOVERFLOW

This was the previous behavior prior to commit
fc3d70736e4c24cbdc8c91076013c01e487fd4d5.
The new behavior introduced by that commit is to preserve as much of the
buffer as possible. But that introduced a regression in applications with
so many overflows that they can't recover. So now the flush is optional.

Test: at bug
Bug: 36725187
Change-Id: Ia728a754405c89b5c46fea598f987ddb9e1e26d8
/system/media/audio_utils/fifo.cpp
fc3d70736e4c24cbdc8c91076013c01e487fd4d5 06-Mar-2017 Glenn Kasten <gkasten@google.com> fifo: handle overrun correctly

On overrun, allow a non-throttling reader to read any frames not yet overwritten.

Also provide an exact count of lost frames rather than an estimate,
when the fifo is configured with a non-power-of-2 capacity.

Bug: 36003483
Test: media.log and fifo interactive unit test
Change-Id: Ia0a7b6f1043f1cd34f6b4fa779785afeff34c5c9
/system/media/audio_utils/fifo.cpp
2f99531ca3ace4d7d399ac36b4eafc69f8a90e5e 16-Dec-2016 Glenn Kasten <gkasten@google.com> fifo: non-throttling reader doesn't see data already written

Test: see the multi-reader interactive test
Change-Id: I0663a8e90efc094fef09401c6e2ecd3391100efa
/system/media/audio_utils/fifo.cpp
7cc8f545385d09aaa0c6e081856d7e3c8e500133 02-Dec-2016 Glenn Kasten <gkasten@google.com> fifo: isolate atomic and futex operations

Now all atomic and futex operations occur in fifo_index.cpp.
This implements these TODOs:
- Abstract out atomic operations to audio_utils_fifo_index
- Replace friend by setter and getter, and abstract the futex
This is one of a series of CLs to isolate the dependencies.

Test: builds OK on Android, host Linux, and host macOS
Change-Id: Ic4ec46d472c583dce8525f11ed8cb1db89928d30
/system/media/audio_utils/fifo.cpp
be9f4d88b19a052f4fbafcee3a1f05ff6fdbb6ad 01-Dec-2016 Glenn Kasten <gkasten@google.com> fifo: pull out clock_nanosleep and futex to separate files

This is one of a series of CLs to isolate the dependencies.

Test: builds OK on Android, host Linux, and host macOS
Change-Id: I8ffcab7b7c4acab141b09f75f593ebde1ebec31a
/system/media/audio_utils/fifo.cpp
0b2947b464581b0f6e7426c6a2894494fafba324 22-Nov-2016 Glenn Kasten <gkasten@google.com> fifo: add shutdown state

FIFO is marked shutdown after an "impossible" error is detected.
Usually this indicate that memory has become corrupted, or incorrect use
of the API. Once the FIFO is marked shutdown, all APIs that can return
an error code will return -EIO, and all other APIs will become no-ops.

Test: see unit tests in tests/ directory
Change-Id: I559145d613c3783a699a9ced062dd5ff3676769d
/system/media/audio_utils/fifo.cpp
3f115bac767924581bb0bef9fcc16df368a7af47 22-Nov-2016 Glenn Kasten <gkasten@google.com> fifo: use const more

Test: builds OK
Change-Id: I81c4e656b65e9e50f3affb11aeb3b51b0a36e3f7
/system/media/audio_utils/fifo.cpp
b9652ab79b4e0f2ca2ad6963ab4988c7ca8a6c44 18-Nov-2016 Glenn Kasten <gkasten@google.com> Rename hysteresis-related symbols for clarity

Test: builds OK
Change-Id: I47fc5c5b7cbe6354386e143a5f9a5b5f9f3322a6
/system/media/audio_utils/fifo.cpp
0f8503915063b614599fd8016a550b1f408f7c2d 19-Oct-2016 Glenn Kasten <gkasten@google.com> fifo: add new APIs, and other cleanup

New APIs:
- buffer()
- capacity()
- flush()
- frameSize()
- totalFlushed()
- totalLost()
- totalReleased()

Pull up mFifo from writer and reader into the base provider class.

Update documentation.

Test: see unit tests in tests/ directory
Change-Id: I1957638c69e1c1dc742b6f024156def757736867
/system/media/audio_utils/fifo.cpp
23f5bc220fc7892daae5b6444e69631623f206d6 03-Nov-2016 Dan Willemsen <dwillemsen@google.com> Fix build with MacOS 10.12 SDK

Test: mmma -j system/media/audio_utils
Change-Id: Iab8270c5f2dc011a984acd78f59a3adca73b7a62
/system/media/audio_utils/fifo.cpp
44001d498c1718d3405905010d4523df587916cd 20-Oct-2016 Glenn Kasten <gkasten@google.com> fifo: fix bugs in lost frames calculation

Problems fixed:
- did not set the lost frames parameter to zero when no frames were lost
- under-estimated lost frames by mFrameCount

Also improved the documentation about lost frames.

Test: currently using interactive test only, need an automated version
Change-Id: I8b056c9cf4ead0d197b4c3aeff8482a08710c4cb
/system/media/audio_utils/fifo.cpp
7cabff9c1ea2fde87835267d7924d816d1d9f3cd 19-Oct-2016 Glenn Kasten <gkasten@google.com> fifo: address code review comments

Test: builds OK
Change-Id: I20f1a2e0cf0d63e4a5c04bf7f3364d0e71d8e929
/system/media/audio_utils/fifo.cpp
f277a7caf13e25a9fb9150bb025e92d634b11195 14-Oct-2016 Glenn Kasten <gkasten@google.com> Handle futex status EWOULDBLOCK

Test: very difficult, as it is a race condition that rarely occurs
Change-Id: Ibefe09d1e9d940f57463391ed339325b42b84b73
/system/media/audio_utils/fifo.cpp
6d17b7054f3f4864b2482465ec21378539faf114 18-Oct-2016 Glenn Kasten <gkasten@google.com> Merge "Address code review comments"
d9942f73f2bb5222d1f155aa6a6f317b6396ff72 16-Oct-2016 Glenn Kasten <gkasten@google.com> Change struct timeout * to const struct timeout *

Test: builds OK
Change-Id: I8372ab83a50d527dffbfbb5014ac93ee4692f577
/system/media/audio_utils/fifo.cpp
9ddeb2c5c17285f8d0cc9d7db6555d7efee9817b 14-Oct-2016 Glenn Kasten <gkasten@google.com> Address code review comments

Change INT_MAX to INT32_MAX.
Document iovec == NULL.
Strengthen TODO about re-architecting futex code.
Rename getSize() to size().
Simplify error handling for mFifo.diff().
Rename masked to offset.

Test: re-run tests/*
Change-Id: I51f0c457399ac12b282eee726d13c3ca9a58ed1a
/system/media/audio_utils/fifo.cpp
c16f93d38923ffdf7894f763670723665e9fc742 14-Oct-2016 Glenn Kasten <gkasten@google.com> Fix build

Test: build for sdk_phone_mips-sdk (mac) works
Change-Id: Ifc839975d1fc994beeb1651280e2d94e8b7a3199
/system/media/audio_utils/fifo.cpp
c0924bc38334c7adbf8cbc9cfa9d00559c002652 02-Oct-2016 Glenn Kasten <gkasten@google.com> fifo: improve blocking and hysteresis

Work-in-progress to eventually allow the application to independently
specify whether or not each index (both front and rear) is also treated
as a futex, and if so whether it is single-process or multi-process.
This involves replacing mIsPrivate by an enum for futex types.
Still to do:
- provide an API to configure this
- better testing

Continued work on the setHysteresis() API.
Still to do:
- better testing and debugging, especially for the read side.
- do the right thing based on data currently in the buffer

Added available() API to return the number of frames that could
be obtain()ed. For reader, this is the fill level.

Miscellaneous:
- renamed sharedRear to writerRear
- improved Doxygen comments
- address code review comments by explaining why some paramters are
passed by reference and some as pointers
- updated tests
- fixed bug: iovec was not being clear on error
- changed default value of throttlesWriter to true

Test: tests/fifo_*
Change-Id: I0e19052abc90453ca48a0299d2c2de62468de6cb
/system/media/audio_utils/fifo.cpp
dc1ff1f1ee8bdd6baccd558bd4e279ffbbe01400 02-Sep-2016 Glenn Kasten <gkasten@google.com> fifo: Add support for multi-process

For multi-process, the indices are allocated in separate shared memory.
This permits the buffer, write index, and throttling read index to each
have their own protection.

By default, the indices are allocated within the object to retain
API compatibility for the single-process case.

Test: in next CL
Change-Id: I5fae59169dbf73e8e38bf0eba0dcf907da2f8679
/system/media/audio_utils/fifo.cpp
86c4a6da76eb80896349703c4d4bb928722e0110 09-Jul-2016 Glenn Kasten <gkasten@google.com> Continue fixing build break on Mac

Change-Id: I228236617076cbe43818df6fa01749408f5646e2
/system/media/audio_utils/fifo.cpp
9052f3b550e82b0dc6ea83f9cbe37e5a0b6f2573 09-Jul-2016 Glenn Kasten <gkasten@google.com> Fix build break on Mac

Change-Id: I5f5be69ed50605c03219d40e7c6d2198ac5b496a
/system/media/audio_utils/fifo.cpp
3ddacbbcd6c119d3c47a50a9291fdff91fb98386 20-Jun-2016 Glenn Kasten <gkasten@google.com> Add blocking with optional timeout, and effective buffer size

Change-Id: I15d133bcbe257e1ee767e9dd155e2b646019d59e
/system/media/audio_utils/fifo.cpp
0ab1d86bc08d6d94721a87dafd62beedd384ac4b 20-Jun-2016 Glenn Kasten <gkasten@google.com> Address earlier code review comments

Change-Id: I4d369ba153676d0990dadf9b1269506607adec7f
/system/media/audio_utils/fifo.cpp
a7a0e047ccda50c9eedd16d5ea4cef0b0d2803cc 17-Jun-2016 Glenn Kasten <gkasten@google.com> Fix review comments for earlier CL

Change-Id: Ia4a637f5d46f8ef0d7d5cefb953565c091c79df3
/system/media/audio_utils/fifo.cpp
169f3a203c9cb698098d29d5353dd6cb71f03992 17-Jun-2016 Glenn Kasten <gkasten@google.com> iovec is offset and length now

Change-Id: I0e6c2186382d600e9e2a60e0347b78de972f0149
/system/media/audio_utils/fifo.cpp
09acf7816f5ed575051d5d60be60d3c2bccc5ddb 17-Jun-2016 Glenn Kasten <gkasten@google.com> Pull out base class that has no knowledge of frame size or buffer

Change-Id: I0727601faf9766c4ed2d08346f53257c20337fe7
/system/media/audio_utils/fifo.cpp
6d7ad76b2a2b04f3a61605ca1ca019a80b94d339 16-Jun-2016 Glenn Kasten <gkasten@google.com> Add multi-reader support

At most one reader throttles writer.
All other readers must keep up with writer, or are informed of lost frame count.
Refactor reader, writer, and buffer provider APIs as separate classes.

Change-Id: If2007a4f56d40ac892e899632d261fcfee0ea9e4
/system/media/audio_utils/fifo.cpp
547a99206f741bbe5adacd9bf8b75c2d6b2aff0d 15-Jun-2016 Glenn Kasten <gkasten@google.com> Add internal fifo API for obtain/release

Change-Id: Ife65218788d709768f0ede1cac144327a82e5f15
/system/media/audio_utils/fifo.cpp
9b4fe47208fbc80e5a56508fc8e7210fa4d888ad 13-Jun-2016 Glenn Kasten <gkasten@google.com> Replace fifo C API and implementation by C++

Improvements to library:
- Replace Android atomics by C++ atomics
- struct -> class
- init -> constructor, deinit -> destructor
- Avoid signed arithmetic for security
- Fix usage in test
- Add README
- Improve error recovery by returning a status_t if indices are corrupt
- Fix bug in diff when assertions enabled
- Add local indices in preparation for multi-reader and protected pages
- Add more documentation for internal methods

Improvements to unit test:
- More error checks
- Fix double delete of fifoBuffer
- Support 8-bit wav files
- Enable assertion checks

Change-Id: I8b391b17084084d8e692765ed210a35aaa0b6747
/system/media/audio_utils/fifo.cpp
f918c359b42bd88b921db2a7193a035f012e8d21 13-Jun-2016 Glenn Kasten <gkasten@google.com> Rename fifo.c to fifo.cpp

Change-Id: I4da71224b2af2498fce7bbe4c129100a822f2025
/system/media/audio_utils/fifo.cpp