History log of /system/media/opensles/libopensles/IBufferQueue.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2a25d97e40dbd5dd9195195a3a269095a4932097 05-Oct-2010 Glenn Kasten <gkasten@google.com> Object an interface initialization/destroy cleanup

Prior to this, object and interface fields were being initialized
and deinitialized in random places. This resulted in some real and
potential leaks, especially in the case of partial object construction.
There were even some places where fields were not being initialized
at all.

Details:

Move destructor for AndroidEffectCapabilities from CEngine::Destroy
to IAndroidEffectCapabilities deinit hook.
Move destructor for equalizer preset names from CEngine::Destroy
to IEngine deinit hook.
In Object::Destroy, call deinitializer for each initialized interface,
regardless whether it was ever exposed.
Remove double initialization of mStepSize in IPlaybackRate constructor.
Remove obsolete logs.
Add expose hooks that are called when interface is requested in
Engine::Create... or by DynamicInterface::AddInterface.
Always initialize all interfaces, even if not exposed
Fix typos in same-line comments on INTERFACE_ constants.
Add new interface state INITIALIZED: uninitialized -> initialized -> exposed.
DynamicInterface::Remove sets interface state to initialized (but
not exposed), instead of uninitialized.
Add explicit constructor calls to initialize fields in C structs
(e.g. smart pointers), using placement new. See also build warning
which was turned off with -Wno-invalid-offsetof.
Add comments about per-instance fields not associated with an interface.
Add default initializations for all per-instance fields that are
not associated with an interface, in case the object is only partially
constructed and then needs to be destroyed due to an error.
Add placement new comments.
Update comments on private per-instance fields not associated with an interface.
Move effect clears from the containing object destructor
(CAudioPlayer_Destroy and COutputMix_Destroy) to the interface
destructor. In this process this caught a bug that environmental
reverb and preset reverb were not being destroyed properly for an
audio player.
Add comments on interface hooks.
Add entries for interface destructors.
Add placement new (explicit constructor) and explicit destructor calls
for C++ fields in C struct.
Fix template instantiation error.
Move explicit calls to IBufferQueue_Destroy (now renamed to
IBufferQueue_deinit) from CAudioPlayer_Destroy and CAudioRecorder_Destroy
to be implicit via the BufferQueue interface deinit hook.
ThreadSync interface destructor now logs a warning if
ThreadSync::EnterCriticalSection was active at Engine::Destroy
Add some comments.
Clean up gMonitorFp close code.
Fix typo in log message.
Fix DynamicInterface to handle distinction between UNINITIALIZED and
INITIALIZED states for an interface, and to call the optional expose hook.
Do not use memset per interface, because the size of the last interface is unknown.
Set the v-table pointer while lock is held.
Add curlies to if statements.
Log errors if interfaces active during Object::Destroy, instead of asserting.
Log a warning if interface requests an interface but it is not available,
and is optional.
Add log with the class name and address of each new object.
Mark only interfaces with init hooks as INITIALIZED; others are UNINITIALIZED.

Change-Id: Ibb9c1b5f21e6195af6b20b2f7a5c7157905b735b
/system/media/opensles/libopensles/IBufferQueue.c
614d5407d3fac1dae8975722f25e671642041282 29-Sep-2010 Jean-Michel Trivi <jmtrivi@google.com> Code cleanup: function name unification.

Change-Id: I37790738d81bb8d6b5496467a93c17c6f1385b8f
/system/media/opensles/libopensles/IBufferQueue.c
51cb31b09f6af53402b3fbe7e9de29badc1155a2 21-Sep-2010 Glenn Kasten <gkasten@google.com> As part of API review, disable incomplete profiles

Don't compile dead code relating to unsupported features, but keep profiles for CT.
Move whole file conditionals from the source code to Android.mk,
by just not compiling the module for unsupported features.
There must an interface initialization hook present to expose an
interface implicitly or explicitly at object creation time, or
to dynamically add an interface after the object is created. As
a safety check, we also double-check for the initialization hook
when the application does a GetInterface.

Miscellaneous bug fixes:
- Fix warning "variable may be used uninitialized in this function".
- Fix build errors on SDL.
- Was using the wrong conditional for SDL.
- Fix typo mInterfaceContinued -> mInterfaceStates2 in AudioRecorder.
- Fix typo in IEngineCapabilities_init.

Other cleanup:
- Move ugly SDL-specific stuff out of the portable code.
- Combine duplicated code in CAudioPlayerDestroy and
CAudioRecorder_Destroy for freeing buffer queue memory.
- Add curlies to if and do statements.
- Line length 100.
- Decrease engine voices from 32 to 30 (based on max of 32 objects, 1 engine, 1 output mix).
- Disable IRecord_init log.
- Add symbolic link for Android configuration header file.
- Enable trace on Android.
- sl_int64_t is now unconditionally defined rather than only if
ANDROID defined, because it is used by OpenSLES_Android.h which
might be included by SDL also.
- Removed symlink for Android headers

Change-Id: I1a6389257bca09e3819923129a1193473e16669b
/system/media/opensles/libopensles/IBufferQueue.c
07c35e6e57ff8945c4dd836be4486a62316ac64b 25-Aug-2010 Glenn Kasten <gkasten@google.com> Fix bug in BufferQueue::Clear

BufferQueue::Clear must clear playIndex also -- see pg 423 section 9.1.5.
Only print a lock error message if delayed 100 ms.
Object lock debugging did not take into account that cond_wait also releases the lock.
Improve error reporting for recursive locks.
Reduce the noisy output of sawtooth test.

Change-Id: I66a959445de7e0763440e22251465c796bb1883b
/system/media/opensles/libopensles/IBufferQueue.c
9c03f04a9c6cc2a821182c8be8f2efe964a27efe 13-Aug-2010 Glenn Kasten <gkasten@google.com> Make internal implicit interfaces safer.

Add IsInterfaceInitialized.
Don't directly manipulate a buffer queue.
Call the interface via it's named entry points, not the v-table as it may not be initialized/available.
GetInterface enables the v-table not init.
Update Doxygen comments.
Line length 100.
Allow bool, true, and false in C code.
Add a verbose option to seek torture test.

Change-Id: I37c42834422759b881d2ffe4b171d9aa284fde98
/system/media/opensles/libopensles/IBufferQueue.c
23c38816f7c210afae5072fd44658c98fec7e119 17-Jul-2010 Glenn Kasten <gkasten@google.com> Buffer queue and audio player maintenance.

Known problems on Android only (SDL is ok):
High latency on first enqueue, or first after buffer underrun
Play after stop does not resume the current buffer.

Improvements:
Implement BufferQueue::Clear for both Android and SDL.
Play::SetPlayState to Stopped now works for SDL (not yet for Android), and
sets play cursor to start of current buffer.
Play::Pause and Play::Stop while playing now block until done for SDL.
SDL now calls buffer queue callback after each buffer completion, instead of when mixer needs a buffer.
Move SF_INFO sfinfo to CAudioPlayer so we always have good stuff like the sample rate etc.
BufferQueue::Enqueue on a successful enqueue to a formerly empty queue
now kicks off an attribute change followed by a synchronous call to a
hook when first buffer enqueued. Currently unused but could be a way to reduce latency.
Minor comment changes.
Add interface_cond_broadcast.
More logging of errors.
Include source file and line number in logs.
sles_to_android.cpp: needs code for #if 0 sections.
Disable trace logging of BufferQueue::Enqueue and GetState.
Fix printf warnings.
Fix typo in number of interfaces requested at CreateAudioPlayer.
Remove spurious printf and while loop.
Line length 100.
Add intermediate play states which need to be re-mapped.
Fix printf format warnings.
Re-organize the buffer queue initialization.
Implement true seeking based on position for libsndfile.
SndFile is working again, but just barely.
Make it build on non-Android platforms.
BufferQueue::RegisterCallback now checks for STOPPED play state.
Include function name in trace logs.
Enhance test to check buffer queue callbacks, get buffer queue state, get play state.
Fix bug with Stop while Paused not resetting buffer pointer.
Remove obsolete comments and #if 0.
Set enqueue attribute is state is PLAYING and the first buffer is enqueued.
Added slutPrintIIDs.
Update comments.
Fix build warnings.
Fix compile error introduced by the merge.
Fix runtime problems introduced during the merge.
Address code review comments:
- BufferQueue changes apply to AudioRecord also.
- Rename to conform to new naming conventions.
- Add comments.
Fix build warning.
Add interactive buffer queue test application.

Change-Id: I5b00545a599fd9dba96efb834fca2369d149eaaa
/system/media/opensles/libopensles/IBufferQueue.c
bdb243c16be832f5853083480965a437b81df3c8 21-Jul-2010 Jean-Michel Trivi <jmtrivi@google.com> Add support for PCM audio recording in OpenSL ES.

- add support for the AudioRecorder object in Android, not just for
the conformance tests.
- map the SL AudioRecorder object to the AudioRecord class.
- only allow buffer queue data sinks.
- more work required for the recording format, and input device
selection.

Change-Id: I4c65a8fa0ab162036f0eed4b756431f465325cd3
/system/media/opensles/libopensles/IBufferQueue.c
158dbd1a71a890d29490198c8e5019081ac94ac3 14-Jul-2010 Glenn Kasten <gkasten@google.com> Logging and comments to make testing easier.

Add utility function to print an IID.
checkDataFormat now prints a detailed log on invalid format.
Use SL_LOGE and SL_LOGV for logging instead of fprintf, we can easily redirect to standard Android logging eventually.
Add Doxygen-style comments.
Log more specific error message on invalid data format.
Use the full copyright header in one file.

Change-Id: I2342e29f57e97c3b5d94cb219d00e767a75e93fa
/system/media/opensles/libopensles/IBufferQueue.c
f51f5c6ec99ebc8f2c833a68f232bc1c874a7f2f 09-Jul-2010 Glenn Kasten <gkasten@google.com> Bug fix and general code cleanup.

Trace debug now uses Android logging by LOGV/LOGE.
Added SL Utility Toolkit for OpenSL ES, similar to OpenAL UT.
Add a -DUSE_TRACE instead of -DNDEBUG and add it commented out to Android.mk.
LOGE for error returns, LOGV for all entry and exit.
Rename debug.c to trace.c.
slutPrintIID prints the symbolic name if known.
Fix bug in slQueryNumSupportedEngineInterfaces and
slQuerySupportedEngineInterfaces which were not
skipping over unavailable interfaces.
Use USE_CONFORMANCE to return SL_RESULT_FEATURE_UNSUPPORTED when not supported
and make some interfaces unavailable depending on USE_CONFORMANCE.
Move most FIXME to separate bug/to-do list.
Fix possible intermediate overflow in duration computation for sndfile.
Line length 100.
Address code review comments, disable LOG.
/system/media/opensles/libopensles/IBufferQueue.c
f156301680273e71e56e898f98798f5b5b2431f6 03-Jul-2010 Glenn Kasten <gkasten@google.com> Trace debug support.

Add Enter/Leave interface macros for trace debugging.
3D interface methods do not block for now.
Line length 100.
Add blank lines between interface methods for clarity.

Change-Id: I412936e8574f95308731e41f8b854fe342cb04b6
/system/media/opensles/libopensles/IBufferQueue.c
9db8335361c67c4ed877f68218835df96ce43a4b 21-Jun-2010 Jean-Michel Trivi <jmtrivi@google.com> For Android code, use ANDROID flag rather then USE_ANDROID.

Change-Id: I4b5877d8b6aee37bb472c817a2a863104271a03b
/system/media/opensles/libopensles/IBufferQueue.c
437f9ab9914ea61112aa496a047162a0d22194cd 07-Jun-2010 Glenn Kasten <gkasten@google.com> Add note about bug in IMuteSolo channel count.

Change-Id: Iccb78019bbbffaa98eaa8877258d88a77c979e48

Remove spurious NDEBUG, init in same order as .h.

Change-Id: Ia30b30ce4dbc8f074632c275583b7ef6069141dc

Implement asynchronous Object.Realize

Added ThreadPool mechanism for asynchronous operations.
Fixed off-by-one bug in BufferQueue that didn't use the last buffer.
Added engine hooks for Realize and Destroy.
Realize hook and callback are now called with mutex unlocked.
Added new Object states realizing 1 and realizing 2, mapped to unrealized.
Asynchronous realize on an engine is forced to be synchronous.
Engine initialization now done at Realize, not during CreateEngine.

Change-Id: I9c11461dbeab97aec04f8266f268cfd16086b5a7

Port to Android.

Change-Id: I0fff9f32e4d374230ab940e00fe6b8429b143ed3

Shutdown the sync thread when engine is destroyed.

Change-Id: I197267e5eaa4a49cacb34bc6e6f9c6fa92b381b5

Mutex unlocked during the initialization phase of DynamicInterfaceManagement.AddInterface.

Change-Id: I16000a2c4f1f9e93075f08ac2eaad6a8f12ba9da

Dynamic interface removal is done with mutex unlocked.

Change-Id: I5317d859dee680ca1c96e803388f2475f7795099

Normalize SLboolean input parameters.

Store non-zero boolean value as SL_BOOLEAN_TRUE rather than original value.
Line length 100.

Change-Id: I867ae8dd328b1427be98dfd148e32fcba38ce409

More input parameter checks.

Line length 100.
Fix a few build warnings.

Change-Id: I78fb1415fed649e05a370cf60e015a7fe13ffe8c

Address code review comments.

Change-Id: Ic7f2c70ded42f3d0e5e92f173cf80e084e54fc89
/system/media/opensles/libopensles/IBufferQueue.c
226ce6a635c4a333a66b8e0ea28316a6d405ee33 02-Jun-2010 Jean-Michel Trivi <jmtrivi@google.com> For audio players with URI data source:
- Modify stereo volume update to also work on a MediaPlayer.
- Add support for completion callback when play event mask
specifies SL_PLAYEVENT_HEADATEND
Before changing a property related to the SLVolumeItf or
SLPlayItf, check that the property has changed before applying
it to avoid useless calls and computations.
Cleanup in playUri test and compile without warnings.
Remove "driver" test content: test app was previously moved
to tests/pcmBufferQueue.
According to spec: initialize periodic update for SLPlayItf
and SLRecordItf to 1s.
Change-Id: I00dad162eac7c0d88b535ab65e2351353b8888d5
/system/media/opensles/libopensles/IBufferQueue.c
09f49a84b259d8b8c49a4d71b42ea801b2a9e8f2 02-Jun-2010 Glenn Kasten <gkasten@google.com> Improve resource recovery.

Better cleanup in AudioPlayer.Destroy.
Avoid mallocs in LEDArray and Equalizer.
Line length 100.

Change-Id: I2d22880b27ccf7e9038b398cae9287781fd82253

Continued work on threading.

Lay the groundwork for true asynchronous realize.
Call all callbacks with mutex unlocked.
C volatile is meaningless.
Start adding support for suspend/resume on interfaces.
Line length 100.

Change-Id: I631cb4f123143e4ef79c6c491d12b1e559857cab
/system/media/opensles/libopensles/IBufferQueue.c
4c0d2128c7c0a8b40803026d92083b6affc417d2 02-Jun-2010 Glenn Kasten <gkasten@google.com> Simplify initialization of AudioPlayer.

Clear whole object at initialization. Remove spurious NDEBUG.

Change-Id: Idb116722d95526f8204200d14ca1bafbedd19936
/system/media/opensles/libopensles/IBufferQueue.c
ee35e132113602e20012829377d16f0572c61195 27-May-2010 Glenn Kasten <gkasten@google.com> Compile (almost) all .c as C++ for Android.

Change-Id: I2213f8cd615723b5d1dc34ba206bf3f900b44739
/system/media/opensles/libopensles/IBufferQueue.c
050feed71109208b772e5be2e1a637b82f9d05fc 26-May-2010 Jean-Michel Trivi <jmtrivi@google.com> Move OpenSL ES library implementation to the libopensles folder.
Add an Android makefile for libopensles.

Change-Id: I1480bf46c7165cd35bb55aef1f11fb0a04fff88e
/system/media/opensles/libopensles/IBufferQueue.c