OSDN Git Service

android-x86/system-media.git
13 years agoFix bug 3004701 do not prefetch during Realize.
Jean-Michel Trivi [Tue, 28 Sep 2010 00:12:52 +0000 (17:12 -0700)]
Fix bug 3004701 do not prefetch during Realize.

Removed unused Android object states in enum, not used in
 play state machine.
Made SfPlayer responsible for the creation of its
 AudioTrack once it knows the sample rate and number of
 channels of the content to play once it's done
 preparing.
Added notification from SfPlayer to signal when it's
 done preparing. This informs of the audio characteristics
 and kicks off the content prefetching.
In the AudioPlayer realize:
 - do not start the prefetching, do it when the player
  is set to PAUSED
 - don not create the AudioTrack, do it when SfPlayer
  is done preparing.

Change-Id: Ic345040e71cef0e5953ea47366930d1dfbc5e761

13 years agoMerge "Destroy for an unrealized engine was hanging" into gingerbread
Glenn Kasten [Tue, 28 Sep 2010 00:13:09 +0000 (17:13 -0700)]
Merge "Destroy for an unrealized engine was hanging" into gingerbread

13 years agoRemove old stream type code that's not used anymore.
Jean-Michel Trivi [Tue, 28 Sep 2010 00:05:06 +0000 (17:05 -0700)]
Remove old stream type code that's not used anymore.

Change-Id: I66e0d93ffa8fbf8fd64642d5554026513d561153

13 years agoDestroy for an unrealized engine was hanging
Glenn Kasten [Mon, 27 Sep 2010 23:35:50 +0000 (16:35 -0700)]
Destroy for an unrealized engine was hanging

Change-Id: Ib11b15fe40726d2f9aad0c54fa66382824c95cfa

13 years agoInitialize mEffects if audio player partly created
Glenn Kasten [Mon, 27 Sep 2010 15:37:09 +0000 (08:37 -0700)]
Initialize mEffects if audio player partly created

See https://android-git.corp.google.com/g/70088
File opensles/libopensles/android_AudioPlayer.cpp
Line 1111:     if (NULL != pAudioPlayer->mAndroidEffect.mEffects) {
mAndroidEffect.mEffects is not initialized to NULL.

Change-Id: Ic6b952748c7a8024c797d7bec4a26cb138fa8840

13 years agoFix AudioTrack sessionId bug
Jean-Michel Trivi [Mon, 27 Sep 2010 17:50:34 +0000 (10:50 -0700)]
Fix AudioTrack sessionId bug

The sessionId associated with an AudioPlayer is initialized during
 its creation. The sessionId was not passed to the AudioTrack
 constructor.

Change-Id: I9ccafd707313367f8da78013575cd6048637f240

13 years agoRemove unused Android object type AUDIOTRACK_PUSH
Jean-Michel Trivi [Mon, 27 Sep 2010 16:49:47 +0000 (09:49 -0700)]
Remove unused Android object type AUDIOTRACK_PUSH

Change-Id: I1ab5494ae47239eed0b0a18dc817e3b0ead37871

13 years agoMerge "Support content looping for URI and FD data sources." into gingerbread
Jean-Michel Trivi [Mon, 27 Sep 2010 16:37:38 +0000 (09:37 -0700)]
Merge "Support content looping for URI and FD data sources." into gingerbread

13 years agoSupport content looping for URI and FD data sources.
Jean-Michel Trivi [Sun, 26 Sep 2010 20:15:05 +0000 (13:15 -0700)]
Support content looping for URI and FD data sources.

Implement SetLoop() on AudioPlayer with URI and FD
 data sources. Only looping over the whole duration
 of the audio content is supported here.

Change-Id: Ic033f61063e57c3a9f8c51bad15852a42b21ab46

13 years agoRestore the 2 unmerged equalizer tests
Glenn Kasten [Sun, 26 Sep 2010 21:51:17 +0000 (14:51 -0700)]
Restore the 2 unmerged equalizer tests

Change-Id: I667cfdddd34fff7017fedab9ee84e954c1c9f690

13 years agoLog which effect initialization function is used.
Jean-Michel Trivi [Sun, 26 Sep 2010 21:20:27 +0000 (14:20 -0700)]
Log which effect initialization function is used.

Change-Id: I7c5c7440e50d65faf3dadf360e7a3a23dc5d7781

13 years agoImplement buffer cache fill level and status notification.
Jean-Michel Trivi [Mon, 20 Sep 2010 23:01:25 +0000 (16:01 -0700)]
Implement buffer cache fill level and status notification.

OpenSL ES requires the notification of buffering status
 changes and caching fill level updates. Fill level
 updates happen only when the level has changed by
 a certain amount.

Change-Id: I8b5e82ac1dfff35d7a27eda0dd1f395311d554f3

13 years agoTemporary fix for broken build
Glenn Kasten [Sun, 26 Sep 2010 19:04:19 +0000 (12:04 -0700)]
Temporary fix for broken build

Change-Id: I1b02cbe6ce22766ccbab4e8bf040418eba69d6fc

13 years agoReplace one configuration hack by another
Glenn Kasten [Sun, 26 Sep 2010 16:38:26 +0000 (09:38 -0700)]
Replace one configuration hack by another

Previous hack allowed an application to call GetInterface for any
  interface prior to Realize.  The new hack allows an application
  to do so only for interfaces which have a "pre-realize OK"
  relationship to their associated class.  Currently this is
  SL_IID_ANDROIDCONFIGURATION.
Reduce logging in record test.
Allow default tracing level to be set in makefile.
Line length 100.

Change-Id: Id17c55ee7284dca108e0eab379a8f987963fd8c4

13 years agoCleanup
Glenn Kasten [Sat, 25 Sep 2010 00:39:09 +0000 (17:39 -0700)]
Cleanup

Remove obsolete source file interfaces.c.
Fix typo in conditional compile.
Clarify comment.

Change-Id: I46e93c61fc0d192118a0f17b5b735ec2118298df

13 years agoFix problems found during testing
Glenn Kasten [Fri, 24 Sep 2010 21:16:15 +0000 (14:16 -0700)]
Fix problems found during testing

Fix crash in android_audioPlayer_destroy if audio player is only partially
  constructed, e.g. when using a buffer queue source and the buffer count
  is invalid etc.
Add temporary workaround to buffer queue automated test to be quieter if
  hardware volume control is not working.
Make the record test less noisy on console.

Change-Id: Ief255c3f5f3c94c990f589b2373686b2ac526dd3

13 years agoFix bug found by BufferQueue automated test
Glenn Kasten [Thu, 23 Sep 2010 01:55:12 +0000 (18:55 -0700)]
Fix bug found by BufferQueue automated test

Fix bug for destroying partially constructed audio player.
Remove obsolete logging.

Change-Id: Ib186153bf50ed1311c021d53711ec90d000bdee2

13 years agoAs part of API review, disable incomplete profiles
Glenn Kasten [Tue, 21 Sep 2010 21:49:48 +0000 (14:49 -0700)]
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

13 years agoAndroid simple buffer queue locator and interface
Glenn Kasten [Tue, 21 Sep 2010 23:56:15 +0000 (16:56 -0700)]
Android simple buffer queue locator and interface

Bug fixes:
Fix bug in error handling and recovery for checkDataSource - potential memory leak.
Clean up MPH table; there were some missing and uncommented entries.

Testing:
Add comments about using the END macro to test the MPH table.
Convert feedback test from buffer queue to Android simplified
  buffer queue for rx side only, tx is still 1.0.1 buffer queue.
Add option to sample/intbufq test to use build option to decide
  whether to use 1.0.1 buffer queue or Andorid simple buffer queue.
Convert record test for new APIs.

Miscellaneous:
Update hashgen table and add an install rule.
Add comments.
Add more logging.
Line length 100.
Fix build warning.
Double indent.
Fix SL_DATALOCATOR value for FD.

Change-Id: I35cce8934157fed88251e846b1beb15523b2b1a6

13 years agoAdd explicit dependency to utility library.
Glenn Kasten [Tue, 21 Sep 2010 23:20:16 +0000 (16:20 -0700)]
Add explicit dependency to utility library.

Change-Id: I3a85b071b355ac9e0c330a71e6457cb01b665af0

13 years agoQuick fix for build break, real fix to follow
Glenn Kasten [Tue, 21 Sep 2010 22:59:30 +0000 (15:59 -0700)]
Quick fix for build break, real fix to follow

Change-Id: Ib8542a689a0287fe19cd74b14eceb6b4a8b6afeb

13 years agoUpdate logging
Glenn Kasten [Mon, 20 Sep 2010 18:55:34 +0000 (11:55 -0700)]
Update logging

Fix bug in ifdef __cplusplus for OpenSLES_Android.h.
Clean up, simplify, and change level of a few log messages.
Use SL_LOGx macros instead of LOGx in SfPlayer.cpp.
Add comments regarding unsupported runtime log level checks.
Line length 100.

Change-Id: I52441ed6fbe9550248fa1b6944fc8e199f1f2724

13 years agoFix bug 3022251
Jean-Michel Trivi [Tue, 21 Sep 2010 18:32:41 +0000 (11:32 -0700)]
Fix bug 3022251

Remove prefetch status error codes: not officially in OpenSL ES spec.

AndroidEffectCapabilities: no const for effect name

Android file descriptor data source: don't use a value that will
 likely be used by the specification in the future.

Change-Id: I9b4e0d7eb265dc98c76021cddfe5a1f50b5eb6ef

13 years agoMerge "Fix bug 3011821 OpenSL ES Volume chain configuration" into gingerbread
Jean-Michel Trivi [Mon, 20 Sep 2010 17:35:03 +0000 (10:35 -0700)]
Merge "Fix bug 3011821 OpenSL ES Volume chain configuration" into gingerbread

13 years agoFix bug 3011821 OpenSL ES Volume chain configuration
Jean-Michel Trivi [Mon, 20 Sep 2010 00:37:01 +0000 (17:37 -0700)]
Fix bug 3011821 OpenSL ES Volume chain configuration

When setting effect send levels, combine player volume level
 with send level since AudioTrack doesn't have a distinct volume
 and direct level. This fix ensures the send level changes
 according to the player level, without being affected by direct
 level changes.
When setting player volume, update the send level.

Change-Id: I372434267a7107c617a0fdd8c39e92e31e4c339b

13 years agoMerge "Enable semi-standard logging (does not use LOG macros)" into gingerbread
Glenn Kasten [Mon, 20 Sep 2010 16:40:23 +0000 (09:40 -0700)]
Merge "Enable semi-standard logging (does not use LOG macros)" into gingerbread

13 years agoEnable semi-standard logging (does not use LOG macros)
Glenn Kasten [Mon, 20 Sep 2010 16:18:40 +0000 (09:18 -0700)]
Enable semi-standard logging (does not use LOG macros)

This is a workaround for conflict in Stagefright's definition of LOG.

Change-Id: I985e2c08d6e86a1664654a2e8a0b8aea145b32ba

13 years agoFix AudioRecorder initialization error.
Jean-Michel Trivi [Mon, 20 Sep 2010 03:38:56 +0000 (20:38 -0700)]
Fix AudioRecorder initialization error.

CAudioRecorder fields mNumChannels and mSampleRateMilliHz are
 initialized in IEngine.c CreateAudioRecorder(). It is an error
 to reset them in the Create of AudioRecorder.

Change-Id: I61568b225ad1303a3f8b0d846aac8c0b848386f1

13 years agoFix bug 3009239
Jean-Michel Trivi [Mon, 20 Sep 2010 02:21:36 +0000 (19:21 -0700)]
Fix bug 3009239

Query AudioRecord position for SLRecordItf->GetPosition()

Change-Id: I1a520b281d44105d34c92fd555e71013d5170c76

13 years agoChange object state test for SLAndroidConfigurationItf.
Jean-Michel Trivi [Sun, 19 Sep 2010 22:04:23 +0000 (15:04 -0700)]
Change object state test for SLAndroidConfigurationItf.

Change-Id: Iabd024720f361bcfa50f3a5daa433afa6caa4930

13 years agoRemove the SLAndroidStreamTypeItf interface.
Jean-Michel Trivi [Fri, 17 Sep 2010 23:03:11 +0000 (16:03 -0700)]
Remove the SLAndroidStreamTypeItf interface.

It is now replaced by SLAndroidConfigurationItf which implements
 the same functionality (and more).

Modified test to demo setting AudioPlayer stream type to use
 SLAndroidConfigurationItf

Modified SLAndroidConfigurationItf to enable passing a
 NULL pointer to value so the value size for the key ca
 be queried.

Fixed type in AudioPlayer and AudioRecorder Android side
 which reported an error if the SetConfig() function was
 called when the object was unrealized (the intent is
 to check that the object is NOT realized because we
 are configuring the resources the object is going to use).

Change-Id: I20f3dba8c63066db94d537109854b4c4139f65b3

13 years agoMerge "Turn on the opensl samples." into gingerbread
Yu Shan Emily Lau [Sat, 18 Sep 2010 01:00:33 +0000 (18:00 -0700)]
Merge "Turn on the opensl samples." into gingerbread

13 years agoImprove reliability of Object::Destroy / Create
Glenn Kasten [Thu, 16 Sep 2010 22:55:29 +0000 (15:55 -0700)]
Improve reliability of Object::Destroy / Create

Separated object construction from publishing, for better safety
with respect to the sync and debugger thread.  Unpublished objects
exist and have an ID slot reserved, but the ID is not assigned.
Destroy of an unpublished object does the right thing.

Add pre-destroy checks:

 - COutputMix all platforms: add check for players attached to
   output mix.  Object:: Destroy on an output mix that has at least
   one attached player is a no-op, but will log an error.

 - COutputMix for SDL: now asks the mixer callback to unlink output
   mix from engine, and then blocks until SDL mixer callback
   acknowledges the request; this avoids a race condition where the
   SDL thread calls the mixer during destroy.

 - C3DGroup: add check for players in group.
   Object::Destroy on a 3D group that contains at least one player
   is a no-op, but will log an error.

Object::Destroy on an audio player that is part of a 3D group now
removes the player from the 3D group during destroy.

Remove redundant field:

 - CAudioPlayer.mOutputMix duplicated a field in DataSink.DataLocator_OutputMix;
   removed mOutputMix and replaced by function CAudioPlayer_GetOutputMix
   which gets the output mix from the data sink.

Remove dead code:

 - IOutputMixExt_Destroy was obsolete.

Miscellaneous changes not related to destroy:
 - Fixed an ancient bug in the class table for Listener object -
   was using wrong offset for interfaces.
 - Add curly braces around if, else, for bodies
 - Add parentheses around complex conditionals
 - Add some logging
 - Fix indentation.
 - Line length 100

Change-Id: I0035fe356e2a28c1932b5d265f881377aa77dc58

13 years agoTurn on the opensl samples.
Yu Shan Emily Lau [Sat, 18 Sep 2010 00:19:31 +0000 (17:19 -0700)]
Turn on the opensl samples.

Change-Id: I0ca645fe506e8690d960bf113472a400cd422ea3

13 years agoAllow Android stream type to be set by SLAndroidConfigurationItf.
Jean-Michel Trivi [Fri, 17 Sep 2010 21:33:31 +0000 (14:33 -0700)]
Allow Android stream type to be set by SLAndroidConfigurationItf.

Allow Android stream type to be set through the
 SLAndroidConfigurationItf interface, instead of the
 SLAndroidStreamTypeItf interface, which is going away before
 release.
 The stream type is now stored in CAudioPlayer, and used before
 the AudioTrack of the player is instanciated.

AudioRecorder preset and AudioPlayer stream type also implement
 the following behavior: when querying a key with a NULL pointer
 as destination for the value, the value size is updated with
 the actual size used to store the value for the given key.

Change-Id: I652a5b463a220698c53fc1d2b485143b794a1d75

13 years agoAdd example for SLRecordItf callback registration and use.
Jean-Michel Trivi [Thu, 16 Sep 2010 23:29:12 +0000 (16:29 -0700)]
Add example for SLRecordItf callback registration and use.

Change-Id: Ibcd27f5a49a42ddbcd313b30e7b07b1ce4f13705

13 years agoMerge "Signal recording buffer overrun with SL_RECORDEVENT_HEADSTALLED." into gingerbread
Jean-Michel Trivi [Thu, 16 Sep 2010 23:28:42 +0000 (16:28 -0700)]
Merge "Signal recording buffer overrun with SL_RECORDEVENT_HEADSTALLED." into gingerbread

13 years agoSignal recording buffer overrun with SL_RECORDEVENT_HEADSTALLED.
Jean-Michel Trivi [Thu, 16 Sep 2010 17:03:00 +0000 (10:03 -0700)]
Signal recording buffer overrun with SL_RECORDEVENT_HEADSTALLED.

Signal recording buffer overrun with SL_RECORDEVENT_HEADSTALLED,
 not SL_RECORDEVENT_BUFFER_FULL because this latter is not
 appropriate when recording to a buffer queue, and implies that
 recording stops when it is hit.

Fix locks in IRecord.c: should be exclusive when changing
 record attributes.

Change-Id: I763483a54c92128e3fba9d9c97a091f727f4f7fc

13 years agoMake hashgen build again, and update the hashtable
Glenn Kasten [Thu, 16 Sep 2010 21:33:44 +0000 (14:33 -0700)]
Make hashgen build again, and update the hashtable

Change-Id: Id0e5a25208adb4cef7f1d04fd3cceaff2a7a4554

13 years agoFix bug 3003630
Jean-Michel Trivi [Thu, 16 Sep 2010 01:28:44 +0000 (18:28 -0700)]
Fix bug 3003630

Support record events HEADATMARKER, HEADATNEWPOS, BUFFER_FULL.

In SLPlayItf, remove useless boolean field for marker set and,
 like in SLRecordItf, make ClearMarkerPosition() reset the
 marker to 0.

Change-Id: Iac624d218b79fa7540c371d403de27bc5c291176

13 years agoStore sessionId in AudioPlayer.
Jean-Michel Trivi [Wed, 15 Sep 2010 22:55:11 +0000 (15:55 -0700)]
Store sessionId in AudioPlayer.

Store sessionId in AudioPlayer so it can be passed directly to
 resources that need it, and the same session is kept during
 the lifetime of the AudioPlayer object.

Change-Id: I97c46c88cfb9cc7a8147909f379716522c695b9d

13 years agoFix bug where OutputMix is not fully initialized by CreateOutputMix()
Jean-Michel Trivi [Wed, 15 Sep 2010 20:49:21 +0000 (13:49 -0700)]
Fix bug where OutputMix is not fully initialized by CreateOutputMix()

In the implementation of SLEngineItf, CreateOutputMix() didn't call
 android_outputMix_create() which initializes the mEffects pointers.
Added checks on SfPlayer in case an application start calling
 interface functions when Realize() on an AudioPlayer isn't done.

Change-Id: Id3fb9f02b5c29a1d87255e7935542ebcf4b8dd46

13 years agoFixed C/C++ interworking problem in IAndroidEffect
Eric Laurent [Wed, 15 Sep 2010 16:39:19 +0000 (09:39 -0700)]
Fixed C/C++ interworking problem in IAndroidEffect

The IAndroidEffect structure contains a KeyedVector object
which constructor was not called when the structure was allocated.

The fix consists in changing the structure member to a pointer
to a KeyedVector and create the object from C++ code when the
object containing the IAndroidInterface is created (AudioPlayer
and OutputMix).

Change-Id: I328b4b61537ddb178b33427c6bad06678a29647a

13 years agoMerge "Add prefetch status error definitions." into gingerbread
Jean-Michel Trivi [Wed, 15 Sep 2010 16:04:14 +0000 (09:04 -0700)]
Merge "Add prefetch status error definitions." into gingerbread

13 years agoRename default recording preset to generic.
Jean-Michel Trivi [Wed, 15 Sep 2010 00:07:32 +0000 (17:07 -0700)]
Rename default recording preset to generic.

Change-Id: I77144ebcc593001ca60b94f0176fc2287e7400fd

13 years agoAdd prefetch status error definitions.
Jean-Michel Trivi [Tue, 14 Sep 2010 23:23:32 +0000 (16:23 -0700)]
Add prefetch status error definitions.

Add prefetch status error definitions as defined in post SL ES 1.0.1.
Add fixmes for Android extension discovery.

Change-Id: I36161013f121b0fb0748311df9e8167e45f88808

13 years agoImplement SLAndroidConfigurationItf on AudioRecorder.
Jean-Michel Trivi [Tue, 14 Sep 2010 01:24:59 +0000 (18:24 -0700)]
Implement SLAndroidConfigurationItf on AudioRecorder.

Enable the use of the configuration interface before the
 AudioRecorder object is realized to set the recording
 preset. Recording presets map to the Android
 AudioRecord input source.

Change-Id: I804095a0b39e4676862f6bc8e7fbaa0ba63b9336

13 years agoReduce .so size and hide internal global symbols
Glenn Kasten [Mon, 13 Sep 2010 23:57:10 +0000 (16:57 -0700)]
Reduce .so size and hide internal global symbols

Change-Id: I95b63aa1f4da94ad068619ff0944e4ff83fc6fd6

13 years agoFix some race conditions and deadlocks.
Glenn Kasten [Fri, 10 Sep 2010 00:20:13 +0000 (17:20 -0700)]
Fix some race conditions and deadlocks.

Use strong reference counts to fix race conditions in these object dependencies:
 - audio player on 3D Grouping
 - MIDI player (or more specifically, the data sink locator) depends on LED or Vibra device
 - audio player (or more specifically, the data sink locator) depends on output mix
Fix build errors on non-Android platforms.
Fix incorrect result code for EnvironmentalReverb::SetDensity.
Continue work on making Destroy more reliable:
 - Destroy calls a pre-destroy hook, e.g. for Android audio players.
 - Add new internal object state DESTROYING which is set when the pre-destroy hook returns.
 - Abort (called by Destroy) now blocks until all async operations complete or are aborted.
Add curly braces around simple if and for statements.
Add extra parentheses around complex if expression in if statements.
Add more error logging in checkDataLocator.
Add Doxygen comments.
Remove spurious log entry when SL_DATALOCATOR_ANDROIDFD used.
Disable the unused Resume hooks, which are currently unused.
Remove some dead code in audio player create for Android.
Line length 100.
Prepare for fixing race condition in OutputMixExt by
 moving mActiveMask and mTracks from IOutputMix to IOutputMixExt.
Update comments.
Continued work on Destroy reliability:
 Do not poke around in mixer's data structures directly during
  Object::Destroy for an audio player; instead ask the mixer nicely
  and wait for it to do the job.
 Move master copy of computed gains from Track to AudioPlayer, and then
  let the mixer copy the gains locally when it needs them.
Add resume and predestroy hooks everywhere.
Predestroy hook returns a boolean.

13 years agoAdd SLAndroidConfigurationItf, enabled on AudioRecorder.
Jean-Michel Trivi [Sun, 12 Sep 2010 21:58:04 +0000 (14:58 -0700)]
Add SLAndroidConfigurationItf, enabled on AudioRecorder.

This adds a generic configuration interface, first enabled on the
 AudioRecorder object. This is intended to be used to configure
 the audio recording source. It is meant to be usable before the
 object is in REALIZED state.

Change-Id: I8f6c1cf8f5be8a8dfb332c4e89d91f45047f48e3

13 years agoHide media player looper from AudioPlayer.
Jean-Michel Trivi [Sun, 12 Sep 2010 18:06:51 +0000 (11:06 -0700)]
Hide media player looper from AudioPlayer.

The ALooper that takes care of the rendering loop in SfPlayer is
 only used inside SfPlayer. This CL makes SfPlayer manage the
 lifecycle of its rendering looper.

Change-Id: Ia4d5e02ce0a44bcf79021f428b490612a9fead9c

13 years agoImplement the SLAndroidEffectSendItf.
Jean-Michel Trivi [Fri, 10 Sep 2010 17:47:17 +0000 (10:47 -0700)]
Implement the SLAndroidEffectSendItf.

This enables sends from an AudioPlayer to an OutputMix
that's using the generic effect interface (SLAndroidEffectItf).
Since there is a single aux bus, the effect ID is only used
to verify the effect referred to in the send is actually
attached to the OutputMix. Also there is a single send
level value and enable flag for the interface, even though
the interface definition supports discerning between multiple
effects (so it scales on platform with multiple aux buses).

Dry (direct) level is now stored in the AudioPlayer,
as it is shared between SLEffectSendItf and
SLAndroidEffectSendItf.

Change-Id: I3dd34c4c045d8ac2961a325e10b181a789bf4913

13 years agoDefinition of SLAndroidEffectSendItf
Jean-Michel Trivi [Thu, 9 Sep 2010 18:26:22 +0000 (11:26 -0700)]
Definition of SLAndroidEffectSendItf

Define the SLAndroidEffectSendItf interface which mirors the
SLEffectSendItf interface, but uses an SLInterfaceID parameter
to identify the effect the AudioPlayer is sending to.

Change-Id: Iec0ddf315a6974fafedecd566bd01c7231183312

13 years agoFix aux reverb issues:
Jean-Michel Trivi [Thu, 9 Sep 2010 00:56:50 +0000 (17:56 -0700)]
Fix aux reverb issues:

- when creating an effect, only pass the effect type to the
 AudioEffect framework so it selects whether to use an insert
 or aux effect based on the session.
- SL ES aux reverb effects don't have an explicit SetEnabled()
 function, so enable the effect upon creation, or based on the
preset for the preset reverb effect.

Add a test for SLEffectSend.

Change-Id: I683331cac19cf1fb9628d636569ab3d342c02820

13 years agoFixed the make file which it can build all the sub-dir.
Yu Shan Emily Lau [Wed, 8 Sep 2010 22:59:03 +0000 (15:59 -0700)]
Fixed the make file which it can build all the sub-dir.
Remove the samples temporary until it's fixed.

Change-Id: I6dd9b15a16c3dcc22ecee1fd1acecaebbd59262f

13 years agoFix automated tests testPlayAbsPath and testPlayfilePath
Jean-Michel Trivi [Wed, 8 Sep 2010 18:18:30 +0000 (11:18 -0700)]
Fix automated tests testPlayAbsPath and testPlayfilePath

Do not rewind when reaching the end of the stream.

Change-Id: I98fa7cebc2b2d8fa8d10d371cfb78f24fb1ab277

13 years agoSupport SLAndroidEffectItf on the OutputMix object.
Jean-Michel Trivi [Wed, 8 Sep 2010 17:06:49 +0000 (10:06 -0700)]
Support SLAndroidEffectItf on the OutputMix object.

Change-Id: I098dc047ce91848781c9ba18beec5a33abd50e68

13 years agoFinish implementing the SLEnvironmentalReverbItf interface.
Jean-Michel Trivi [Wed, 8 Sep 2010 01:03:26 +0000 (18:03 -0700)]
Finish implementing the SLEnvironmentalReverbItf interface.

Change-Id: I02bbc6a08607c328253257cbdb6a45b675b9d3ff

13 years agoCleanup SLAndroidEffectCapabilitiesItf example.
Jean-Michel Trivi [Tue, 7 Sep 2010 22:16:57 +0000 (15:16 -0700)]
Cleanup SLAndroidEffectCapabilitiesItf example.

Change-Id: I3b73d089fde7f8ada5387f6e030869356a918b4a

13 years agoFix bug 2947094
Jean-Michel Trivi [Tue, 7 Sep 2010 21:48:49 +0000 (14:48 -0700)]
Fix bug 2947094

"multiplay" is a test that creates an AudioPlayer for each file to
 play. When a player reaches the paused state, SetPosition (ISeekItf)
 is called with a value of 0 (beginning of file). The bug was that
 on Android, the player would stop playing after playing the file
 once or twice.
The bug was caused by the logic in ISeek.c which checks that the
 new seek position is different than the previous one before issuing
 a seek command to the player. The fix consists in not checking
 the old requested seek position so the command is always issued.
 It works on the desktop because the SndFile version was resetting
 the mPos field to SL_TIME_UNKNOWN each time SetPosition was called.

 While investigating this bug, it was also found that the player
 should reset its decode position to 0 each time it reaches the end of
 the stream.

Change-Id: I22f2d6480c62ab6e56c28c7ccae2c117888a7639

13 years agoFix deadlock when stopping the player while destroying.
Jean-Michel Trivi [Tue, 7 Sep 2010 19:11:06 +0000 (12:11 -0700)]
Fix deadlock when stopping the player while destroying.

Do not acquire an exclusive lock on the player when querying play
 callback and event mask, or updating the playstate.

Not related to fix:
Do not notify the end of the stream has been reached once the player
 is stopped.

Change-Id: I9c7e1d96c28d1472ff18174c97544faa8deb0e88

13 years agoStore decoded buffer in player instance.
Jean-Michel Trivi [Fri, 3 Sep 2010 22:14:52 +0000 (15:14 -0700)]
Store decoded buffer in player instance.

Do not store decoded buffer reference in message sent from decoder
to renderer, but rather in player instance. This allows access
to buffer between decoding and playback so the media source can
be correctly stopped.

Change-Id: I7f583366d9895db039ca7d0d9e22f36d0d429f55

13 years agoImplement SLAndroidEffectItf and SLAndroidEffectCapabilities.
Jean-Michel Trivi [Fri, 3 Sep 2010 00:48:22 +0000 (17:48 -0700)]
Implement SLAndroidEffectItf and SLAndroidEffectCapabilities.

Change-Id: Ia2cf6e3f0178189b0ed010690bc9906b61a746a7

13 years agoFix OpenSL ES effect test durations based on audio file duration.
Jean-Michel Trivi [Thu, 2 Sep 2010 23:49:09 +0000 (16:49 -0700)]
Fix OpenSL ES effect test durations based on audio file duration.
Fix make file to build the EQ test.

Change-Id: I509d1f0cea775c4f955c8c23fc27ba313995dd5b

13 years agoImprove test app portability for other platforms
Glenn Kasten [Wed, 1 Sep 2010 21:04:02 +0000 (14:04 -0700)]
Improve test app portability for other platforms

Change-Id: I8793b7e6f6ebd0f83ff8e5bd534234cd1f4166a2

13 years agoMore error logging. Correct error code.
Glenn Kasten [Wed, 1 Sep 2010 00:09:13 +0000 (17:09 -0700)]
More error logging. Correct error code.

Normalize error messages to use similar wording, remove "Error:".

Change-Id: I8746d28c0c0ada43e691f7859d0aaeed25a82dbb

13 years agoMerge "Verify that no extant objects at engine shutdown" into gingerbread
Glenn Kasten [Wed, 1 Sep 2010 21:01:11 +0000 (14:01 -0700)]
Merge "Verify that no extant objects at engine shutdown" into gingerbread

13 years agoVerify that no extant objects at engine shutdown
Glenn Kasten [Wed, 1 Sep 2010 16:22:23 +0000 (09:22 -0700)]
Verify that no extant objects at engine shutdown

Log the total count and ID numbers of any stragglers.
Fix the order of steps in engine shutdown.
Add more comments.

Change-Id: I12b531bcd43c288f9988768193274bad6984748a

13 years agoUse AudioSystem constant for global effect session ID, instead of 0.
Jean-Michel Trivi [Wed, 1 Sep 2010 02:30:08 +0000 (19:30 -0700)]
Use AudioSystem constant for global effect session ID, instead of 0.

Change-Id: Ib3d236e81da7f0764983fba37ffaa76058aa935c

13 years agoSupport auxiliary effects on OutputMix, and direct and send levels
Jean-Michel Trivi [Wed, 1 Sep 2010 00:51:38 +0000 (17:51 -0700)]
Support auxiliary effects on OutputMix, and direct and send levels
 on AudioPlayer.

added global function for mB to attenuation conversion.

Change-Id: Ib7f92397786e4b2e21d6ad51585ac1b542ffab6c

13 years agoUse standard filenames for tests.
Glenn Kasten [Wed, 1 Sep 2010 00:44:17 +0000 (17:44 -0700)]
Use standard filenames for tests.

Change-Id: I0bfc8bd98f00ce1dd9d7e36d402d4cd422cb8ea6

13 years agoFix problems found by the mute solo test.
Glenn Kasten [Tue, 31 Aug 2010 04:37:44 +0000 (21:37 -0700)]
Fix problems found by the mute solo test.

Bug fixes for USE_OUTPUTMIXEXT (desktop):
 - SL_PLAYEVENT_HEADATNEWPOS was broken
 - GetPosition is now accurate, with or without seeking
 - Fix race condition between AudioPlayer and Track
 - Duration is updated if initial estimate is too low (e.g. if unknown is reported as zero)
 - GetPosition while pending Seek now returns that value so the Seek appears synchronous
 - Remove useless code to retry Enqueues; now drop decoded data if Enqueue fails
For all source files touched, add curlies to the "if" statements.

Change-Id: I1f70d8e683bc92831848af20857347d45c6407a9

13 years agoAdd support for auxiliary effects.
Jean-Michel Trivi [Mon, 30 Aug 2010 17:16:06 +0000 (10:16 -0700)]
Add support for auxiliary effects.

- Implement the OutputMix object.

- Modify the interface of the Android effect initialization since
 an effect can be attached to a player (insert) or to an OuputMix
 (aux)
- fix bug in EQ where SL_RESULT_CONTROL_LOST was returned on a
 properly initialized EQ effect.

- Add a test application which creates an EQ on an OutputMix
- Remove unused constant in test apps.

Change-Id: Id9e4633d0e44e8a784f1154ce1a6df1357b72966

13 years agoBuffer queue automated test update
Glenn Kasten [Fri, 27 Aug 2010 22:35:35 +0000 (15:35 -0700)]
Buffer queue automated test update

Make it run on desktop as well as Android, so we can use desktop driver
  for comparison, and get test coverage using gcov.
Use slesutResultToString for error reporting.
Run each test case for all valid numbers of buffers.

Change-Id: If7753a0e77f4a906a41eae90135e1bc84531f2fc

13 years agoFix compile-problem on desktop, and SDL bug.
Glenn Kasten [Fri, 27 Aug 2010 20:51:59 +0000 (13:51 -0700)]
Fix compile-problem on desktop, and SDL bug.

Fix bug caught by using gtest on desktop: SDL was not being shutdown properly when engine destroyed.
Fix compile problems on desktop for BassBoost, Equalizer, and Virtualizer.
Add new OpenSLESUT function: slesutResultToString.
Rename SDL_start to SDL_open to match SDL naming conventions.
Add SDL_close.
Add symlink for applications to use OpenSLESUT.h.

Change-Id: I6ef9895adc508b3b9570c79302c7a3046ca8246f

13 years agoImplement the SLVirtualizerItf interface.
Jean-Michel Trivi [Thu, 26 Aug 2010 23:44:28 +0000 (16:44 -0700)]
Implement the SLVirtualizerItf interface.

Add example for the SLVirtualizerItf.

Unify how an effect interface checks whether a valid effect is
  attached to the interface.

In implementation of SLEqualizerItf, ensure the effect is accessed
  only if its valid (just like for BassBoost and Virtualizer).

Change-Id: I03032de2925488bc78502f23a83972e666435a8b

13 years agoFix bugs found by clang (part of clang fix-it)
Glenn Kasten [Thu, 26 Aug 2010 23:27:40 +0000 (16:27 -0700)]
Fix bugs found by clang (part of clang fix-it)

Serious bugs:
 - SLEqualizerItf::GetPreset was returning wrong preset index.
 - SLEngineCapabilities::QueryVibraCapabilities was returning wrong status code.
Another variable was initialized unnecessarily, but was not a serious bug.

Change-Id: Ifebbae1d457fa800e5adfb09decede4222b60aa1

13 years agoFix bugs in BufferQueue automated test and related
Glenn Kasten [Thu, 26 Aug 2010 17:46:17 +0000 (10:46 -0700)]
Fix bugs in BufferQueue automated test and related

Fix test bugs:
Clean up the player, mixer, and the engine (must be done in that order).
Re-enable 2 more tests; all 9 tests pass now.

Fix engine bugs:
IObject now has a de-init hook, which cleans up condition variable and mutex.
Run the de-initializers in reverse order so that IObject de-init hook is run last.
Replace the dedicated mEngine.mShutdownCond by the shared IObject condition variable.
Forgot to iniitalize mShtudownAck.
Unlocking the object mutex during CEngine_Destroy was bogus.

Miscellaneous logging and debugging improvements:
Track the source code location of the most recent mutex unlock.
Add more trace log options for detailed leave reasons.
Improve performance of trace log when disabled.
Turn on assert checking.
Check return value of pthread_cond_destroy and pthread_mutex_destroy.
Add comment.
Line length 100.

Change-Id: I23b7b495d439894b2fd31295a38cb73ef7b6be2e

13 years agoRefactor effect parameter setting and getting to prepare support
Jean-Michel Trivi [Thu, 26 Aug 2010 17:35:47 +0000 (10:35 -0700)]
Refactor effect parameter setting and getting to prepare support
 for additional effects.
Add support for Virtualizer parameters.

Change-Id: I39c69e883457af6444e49ba64e390213898cd55c

13 years agoSet decode and render thread priority to ANDROID_PRIORITY_AUDIO.
Jean-Michel Trivi [Thu, 26 Aug 2010 01:25:28 +0000 (18:25 -0700)]
Set decode and render thread priority to ANDROID_PRIORITY_AUDIO.

Change-Id: I91843747fd1f51c0eca2d344a22a77d8df853015

13 years agoFix bug in BufferQueue::Clear
Glenn Kasten [Tue, 24 Aug 2010 22:37:38 +0000 (15:37 -0700)]
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

13 years agoImplement the SLBassBoostItf on an AudioPlayer
Jean-Michel Trivi [Tue, 24 Aug 2010 17:38:51 +0000 (10:38 -0700)]
Implement the SLBassBoostItf on an AudioPlayer
Prevent the SLEqualizerItf to use an EQ effect that wasn't
  successfully initialized.

Change-Id: I4cdb07fc4deebba1cb591f0ca96fc3f494e37080

13 years agoFix bug with nested lock.
Glenn Kasten [Mon, 23 Aug 2010 17:23:26 +0000 (10:23 -0700)]
Fix bug with nested lock.

Add object lock debugging.
Replace !NDEBUG by USE_DEBUG.
Remove $(JNI_H_INCLUDE) and $(TOP).

Change-Id: I61217b82a7edc42d37dacf443ad0ca852ee0dfe9

14 years agoTest reorganization
Glenn Kasten [Fri, 20 Aug 2010 23:06:26 +0000 (16:06 -0700)]
Test reorganization

Change-Id: I0fb84afd72fe6839773937fdaece3276bba1b952

14 years agoExercise more functions of the SLEqualizerItf interface.
Jean-Michel Trivi [Fri, 20 Aug 2010 22:05:46 +0000 (15:05 -0700)]
Exercise more functions of the SLEqualizerItf interface.
Refactor EQ effect descriptor initialization in an effect neutral
 function so it can be reused for other effects.

Change-Id: I72d71f7e05f19f0be3541440c1f67269c179b5cc

14 years agoMerge "Clean up interface visibility." into gingerbread
Glenn Kasten [Wed, 18 Aug 2010 00:29:55 +0000 (17:29 -0700)]
Merge "Clean up interface visibility." into gingerbread

14 years agoClean up interface visibility.
Glenn Kasten [Tue, 17 Aug 2010 01:47:13 +0000 (18:47 -0700)]
Clean up interface visibility.

Fix the interface visibility for occurences of an instance within an object.
Check all known interface codes in switch statements for safer error
  detection in case of future changes to the list of enum constants.
Replace USE_CONFORMANCE by USE_BASE, USE_GAME, USE_MUSIC, USE_PHONE, USE_OPTIONAL.
Move comment to Khronos bug

Change-Id: I11892db12590db6d2d6db5191aac5b62ab4f67bd

14 years agoMerge "Re-org the bufferQueue unit tests." into gingerbread
Yu Shan Emily Lau [Tue, 17 Aug 2010 21:59:59 +0000 (14:59 -0700)]
Merge "Re-org the bufferQueue unit tests." into gingerbread

14 years agoRe-org the bufferQueue unit tests.
Yu Shan Emily Lau [Tue, 17 Aug 2010 18:08:20 +0000 (11:08 -0700)]
Re-org the bufferQueue unit tests.

Change-Id: I55d63ca25e98a6b89634c9ec496a07dacb9c71b6

14 years agoFix the MimeUri test:
Jean-Michel Trivi [Tue, 17 Aug 2010 18:41:22 +0000 (11:41 -0700)]
Fix the MimeUri test:
- some logs were reported as errors
- the SLPrefetchItf was declared as required, but not requested in
  the creation of the AudioPlayer.

Change-Id: I33f07ec532ef1d8151aa1bda4f7cfa4d3e64c8ec

14 years agoSupport SLPrefetchStatusItf on an AudioPlayer pulling from a BufferQueue
Jean-Michel Trivi [Mon, 16 Aug 2010 18:57:49 +0000 (11:57 -0700)]
Support SLPrefetchStatusItf on an AudioPlayer pulling from a BufferQueue
- Make SLPrefetchStatusItf explicit on Android as per spec.
- Signal prefetch status underflow when queue becomes empty, and
 sufficient data when filled again.

Change-Id: I0e0ae9dc305fe6d83dd4497741f9271ca465edd5

14 years agoMake internal implicit interfaces safer.
Glenn Kasten [Fri, 13 Aug 2010 20:57:26 +0000 (13:57 -0700)]
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

14 years agoAdd CleanSpec.mk
Jean-Baptiste Queru [Fri, 13 Aug 2010 22:50:40 +0000 (15:50 -0700)]
Add CleanSpec.mk

Change-Id: Ie58a8059aa0259d1aa76880930bf15fdcfb8456f

14 years agoWhen enqueuing a buffer in an empty buffer queue on an AudioPlayer
Jean-Michel Trivi [Fri, 13 Aug 2010 22:04:21 +0000 (15:04 -0700)]
When enqueuing a buffer in an empty buffer queue on an AudioPlayer
 in playing state, restart the associated AudioTrack which was
 stopped when the queue became empty.

Change-Id: I0361a3229fa2bd56c282a8a762f102c7ae23a4c7

14 years agoAdd support for SL_PLAYEVENT_HEADATEND event for AudioPlayer that
Jean-Michel Trivi [Fri, 13 Aug 2010 17:39:36 +0000 (10:39 -0700)]
Add support for SL_PLAYEVENT_HEADATEND event for AudioPlayer that
is fed by a buffer queue.

Change-Id: I573fdadd540d2ee127234299ec9a906504d72cbf

14 years agoMerge "Update use of audio effect framework in OpenSL ES to reflect latest updates...
Jean-Michel Trivi [Fri, 13 Aug 2010 15:34:15 +0000 (08:34 -0700)]
Merge "Update use of audio effect framework in OpenSL ES to reflect latest updates." into gingerbread

14 years agoImplement getPosition for an AudioPlayer reading from a URI or FD.
Jean-Michel Trivi [Thu, 12 Aug 2010 22:56:59 +0000 (15:56 -0700)]
Implement getPosition for an AudioPlayer reading from a URI or FD.

For getPosition, return the last decoded position as the current
 position. This is not accurate but will do for a first pass. Since
 this requires knowing whether it's seeking, a lock is introduced
 to guard against reading the seek flag in getPositionMsec(), and
 it being written in the player looper.

Change-Id: I2af6daa7f1415d8b6463d114a7b61c266fd98c97

14 years agoImplement seeking logic as a state updated in the message looper of
Jean-Michel Trivi [Wed, 11 Aug 2010 22:24:25 +0000 (15:24 -0700)]
Implement seeking logic as a state updated in the message looper of
the player, so no locks are required.

Change-Id: I14f30ab1e3f3cde5d31c4a6d121d1951c1a11995

14 years agoMerge "Cleanup AudioPlayer destroy sequence. Fix seek bug where audio wouldn't play...
Jean-Michel Trivi [Wed, 11 Aug 2010 17:20:22 +0000 (10:20 -0700)]
Merge "Cleanup AudioPlayer destroy sequence. Fix seek bug where audio wouldn't play, or played delayed after a seek." into gingerbread

14 years agoCleanup AudioPlayer destroy sequence. Fix seek bug where audio
Jean-Michel Trivi [Wed, 11 Aug 2010 17:05:29 +0000 (10:05 -0700)]
Cleanup AudioPlayer destroy sequence. Fix seek bug where audio
wouldn't play, or played delayed after a seek.

Change-Id: Id132ddf27774465af3df272707151876bc22f70d