History log of /frameworks/wilhelm/src/android/android_GenericPlayer.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
52e35b2c9f25450452ab422c46737a7fb5b67380 04-Mar-2015 Lajos Molnar <lajos@google.com> stagefright: make AMessage use handler vs handler-id

Bug: 19607784
Change-Id: I55accc49eec725ede0da3d1bfab448320fece926
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
01f8573bc2a850536b02855d483dfe130c050a2f 12-Mar-2013 Ashok Bhat <ashok.bhat@arm.com> AArch64: Minor changes related to 64-bit platform

Changes include
[x] Use %zu for size_t
[x] Use PRId64 to print 64-bit integer value
[x] Use uintptr_t for integer variable used to store address.

Change-Id: I69926cce76b0d645f1abccd584444197a5e40318
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
91145ef159d3e165a461cbd76341ff8ed3d72bae 04-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Playback rate on OpenSL ES AudioPlayer playing from URI/FD

Allow AudioPlayer to use the platform's 500-2000 range (in
permille) of playback rate for audio when the data source
is a URI or FD.
Since play events for those players are simulated through
monitoring the playback position, scale the time
between updates so play events are delivered in content
time, not presentation time (as defined in OpenSL ES
specification, "positions do not scale with changes in
playback rate").

Bug 5898620

Change-Id: Ib512caebd7f3983c9e845be62e48dfee8499e59c
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
70e776a54bc945a6a01717a784e66476bc5d450f 16-Sep-2011 Glenn Kasten <gkasten@google.com> Remove redundant this->

Change-Id: I86eabf51bf79c145d3ceff68f5aa527199d14ef7
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
e62501a9aa791a22f8f35491e74a36a14c8ddd29 30-Nov-2011 Glenn Kasten <gkasten@google.com> am 30f49ce0: Merge "Bug 5622637 missing XA_PLAYEVENT_HEADATPOS" into ics-mr1

* commit '30f49ce0c8f9ee464e87552a6fb4fb3d6b09959c':
Bug 5622637 missing XA_PLAYEVENT_HEADATPOS
eccbfb7d9e4065d5a5a5c1995c69e0eb6b526f5f 29-Nov-2011 Glenn Kasten <gkasten@google.com> Bug 5622637 missing XA_PLAYEVENT_HEADATPOS

Fix problem with a missing XA_PLAYEVENT_HEADATPOS after seek backwards,
due to a race condition between getPosition and onSeekComplete.

Change-Id: I408c8675df8a9b3cbd2874435fbeccdca355bc46
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
e2e8fa36bd7448b59fbcdf141e0b6d21e5401d91 29-Jul-2011 Glenn Kasten <gkasten@google.com> Comments

Change-Id: I1592d1979ce5f5811ff5a47b4b60db93e8670313
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
220b874d41bc8d105ea446d5d556fb3592de965c 28-Oct-2011 Glenn Kasten <gkasten@google.com> am 13ffc7f7: am d0b07222: Merge "Bug 5526807 inform client of errors after prepare" into ics-mr0

* commit '13ffc7f7c69e2fabf1ef70ebb2ea81489be9bd74':
Bug 5526807 inform client of errors after prepare
b6aed97f98afa0c20f5b1e854ac07ccacfcdacc6 28-Oct-2011 Glenn Kasten <gkasten@google.com> am d0b07222: Merge "Bug 5526807 inform client of errors after prepare" into ics-mr0

* commit 'd0b0722276aea9a06a118a64abfc8b3e9498e931':
Bug 5526807 inform client of errors after prepare
5e4d65e369f28746767aba11b618dee314bb8197 27-Oct-2011 Glenn Kasten <gkasten@google.com> Bug 5526807 inform client of errors after prepare

Change-Id: Ic5c88f8e1c8e7d6226a7a71a2a89a70f0fa876f8
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
de7c7da8460de9fb1e8739978f25e1463e2e1666 26-Oct-2011 Steve Block <steveblock@google.com> Rename LOGV(_IF) to ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I4c0e3dc9da0a0cdf9aef8be4fae7b24da876dc17
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
1fa5c3206d06bbebdea2dc92f378ce6b8a211e23 30-Sep-2011 Glenn Kasten <gkasten@google.com> Fix race in getting duration

mDuration is protected by mSettingsLock because it is accessed from both
the ALooper thread and from the application thread, but only one of the
two "set"s was using the lock, and the "get" was not using the lock.

Also added some comments about the lock, and moved lock closer inside { }.

Change-Id: I7c96186f31baaad1b941d934549cb50d4f82d0c8
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
b4393ef4ef3edb785746c37fd7b68950e85283ae 30-Sep-2011 Glenn Kasten <gkasten@google.com> Multithread safety and code reduction

Remove unsafe GenericPlayer::getSampleRate(). getSampleRate() was not
thread-safe as it accessed a member variable updated in the looper thread
without a lock. If getSampleRate() is ever needed again, the sample rate
is available in the mPcmFormatValues array, which does have a lock.

Replace member variables mChannelMask, mChannelCount, and mSampleRateHz
by local variables for locality and performance.

Change-Id: Ibf92ed090430153d748ded4d0b835e429df47eea
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
a9f22e6f5f53e90daa779e38b22f88e4faa35c95 29-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5385386 missing HEADATNEWPOS

Workaround for mediaserver bug where it does not send MEDIA_SEEK_COMPLETE
to the MediaPlayerNotifier after a discontinuity is processed.

Instead, we simulate a seek complete event in this case.
A short delay is applied to compensate for shared memory latency.

A longer-term fix will be to have mediaserver send the event.

Change-Id: Id0d01b842a145fa5762d44f03144741152f7b03f
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
3ac5dcc05fe321e4f01918aef2e3e54e22c9a5c1 17-Sep-2011 Glenn Kasten <gkasten@google.com> Remove dead code

AudioPlayback_Parameters fields trackcb and trackcbUser
audioTrack_callBack_uri
android_Player_androidBufferQueue_registerCallback_l
GenericPlayer field mLooperPriority
StreamPlayer::registerQueueCallback
CAudioPlayer::mpLock
AudioSfDecoder::startPrefetch_async
IAndroidBufferQueue does not support AudioRecorder object
android/BufferQueueSource.h #include

Change-Id: I9d7cef243167e10279df452e7c62e66d8f5fe3b6
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
d6be802c5267a3c8599c11af2c38ead666f74a72 17-Sep-2011 Glenn Kasten <gkasten@google.com> Use async notify everywhere

We use asynchronous notify in all places except PLAYEREVENT_PREPARED.
Since there doesn't seem to be a clear reason why this should be
different, make it be the same.

Change-Id: I0a83d4ac7a7e8e16e3404a25f081176701de01ae
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
7349b2e742b2cedc6d149fac62ed661ad7d47dec 15-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5263052 play events for decoder use case

This version should be more resilient to decode time vs. real time.

Miscellaneous:
- comment about GetPosition accuracy
- remove unused AudioSfDecoder::onRender implementation

Change-Id: I16a7726e0b1459ed1421fe50cb4d683d5c3bdd6b
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
7133228a478e16458b659946f2180ecddd13fda7 09-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5287555 create StreamSourceAppProxy once

Create StreamSourceAppProxy once in the StreamPlayer constructor,
rather than dynamically in StreamPlayer::registerQueueCallback.
As StreamPlayer::registerQueueCallback can be called multiple times
(or even not at all), this guarantees we always have only one
StreamSourceAppProxy that never changes.

Also fix bug where we weren't using a stream protector for AudioPlayer
with MPEG-2 TS AndroidBufferQueue data source (we weren't calling
setCallbackProtector on it).

This has some unexpected side benefits of simplifying the code:
- remove unused parameters and member variables
- mAppProxyLock not needed since the callback protector is created early
- remove GenericPlayer::setCallbackProtector
- inline android_StreamPlayer_realize_l for the use case
AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE to be like MediaPlayer

Change-Id: I090c11cde9474285185481192dba2b5c01338a50
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
ddaf8fec2c6362785f8f27e59e30bf6bfe858f3b 03-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5262776 reliability of play event callbacks

This makes HEADMOVING and HEADATMARKER work more reliably, especially
at the beginning of track and under heavy load. Previously if an event
update was missed because update period is too small or mediaserver/client
is too busy to keep up with notifications, then subsequent events
were lost. This happened more than you might expect; the first event
was often lost and things just got worse from there.

Cleanup in AudioSfDecoder:
- Call up to superclass (GenericPlayer) onSeek and onLoop
to make future maintenance easier.
- Delete dead code in onMessageReceived.
- Logic depends on mLastDecodedPositionUs not being ANDROID_UNKNOWN_TIME
- Simplify getPositionUsec

Add more logging in GenericPlayer::updateOneShot.

Change-Id: Iacddafeb3a20b25bee6da602f6a783201d80be10
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
485a038f9f0f898227b8ab4218e94c5d56b6ed0b 24-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5193695 Fix crash after MediaPlayer destroyed

The StreamSource callback thread was continuing to run after the
MediaPlayer object was destroyed. Fixed by adding a callback protector
and a pre-destroy hook. GenericMediaPlayer::preDestroy now also
calls MediaPlayer::stop just in case.

Change-Id: I5bd771d4d1936f433d2a8c9959593782c96daed9
Miscellaneous:
- added an explicit destructor on CMediaPlayer::mAVPlayer for consistency
(probably not a bug since there was a clear on it earlier)
- updated comments for CallbackProtector
- made some CallbackProtector fields private since no sub-classes yet
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
833251ab9e5e59a6ea5ac325122cf3abdf7cd944 11-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5153313 keep compatibility of local files URI

Also fix a bug in decode from fd to PCM buffer queue, where
we were closing the application's fd.

Change-Id: I220cd1c242f2f5e240b4dd1b9e8d79c88878bdcd
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
85edd878a30caa535b0267d8d6e61b4ccc0d5fd0 13-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5161265 Recover from mediaserver process crash

Use the utility method IMediaDeathNotifier::getMediaPlayerService()
to get a reference to media player service. It retries after errors,
and keeps a single global per-process reference to the service rather
than one per object. If we still can't contact the media player service
after retries, handle it like an unsuccessful prepare.

Miscellaneous:
- Remove unused field Parcel metadatafilter

Change-Id: I451a64bd76b4a7f157774abe967448ec081f1014
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
5933f3d5e532aaac31ce0e6551c59f0197c0ae3c 29-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5903270 play interface, events, markers, etc.

As the media framework does not directly support marker and periodic
callbacks, we use a retriggerable one-shot timer at application level
to emulate this. This has the advantage of being faster, but is also
less accurate than if it were in the framework.

Details:
- Get position is now synchronous and (mostly) lock-free
- Fix regression in SL_PLAYEVENT_HEADATMARKER and SL_PLAYEVENTHEADATNEWPOS
- Fix SMP races in GetPlayState, GetCallbackEventsMask, GetMarkerPosition,
GetPositionUpdatePeriod
- AudioSfDecoder was not updating mPositionMsec when getPositionUsec failed
- Updating attributes is relatively expensive, so only do it when a significant change
in SetMarkerPosition, ClearMarkerPosition, SetPositionUpdatePeriod
- Error on unknown message type in onMessageReceived
- Delete an obsolete FIXME
- "Clearing" a marker is now equivalent to disabling the marker event,
and the default marker position is cleared.
- use Android time units and types (int32_t, ANDROID_UNKNOWN_TIME, etc.) where appropriate
instead of SLmillisecond and SL_TIME_UNKNOWN

Change-Id: Ib78bafa20d883b8d927364769663837389b6ea1d
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
fa2bd93c3a9852a1f879663eeff598d13cf8fa81 25-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 4599730 fix mute solo, channel count, volume

Change-Id: I1624c744168233c4ef79f2cd3090447b8aa7d53b
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
3610785fa93586ce84a27a27530feb77b8035229 22-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5045590 preset reverb on audio players

Aux effects on MediaPlayer audio players (non-AudioTrack) were broken

Change-Id: I5b97bee08d809b12cb9815d6d277934123780581
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
dc93696c78e3a089828188a760ece635cb8d8a09 22-Jul-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5047695 Handle unsuccessful prepare up to app"
49935c51fddcd0caa0030e2aac0c3a7ba3339e3d 21-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5047695 Handle unsuccessful prepare up to app

Change-Id: I9f1541b37ad5cda21dc49388e42c7fb08b22fc5b
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
b2549c73290f1955f3a7731bf98446a45f295dfa 21-Jul-2011 Glenn Kasten <gkasten@google.com> Add more verbose logging

Change-Id: I0cccee0d59fe3eefc6ef94b22bb6100d96bccdff
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
1a9c2615d0933d183fcb1b9e34ec8f0da2a85153 07-Jul-2011 Glenn Kasten <gkasten@google.com> Rename ANDROID_UNKNOWN_* to UNKNOWN_*

Change-Id: I0d92b7d943690d9af7e08c400471f8b474728bff
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
e6ded5c61944a87fa9e472dec3a6929855d42aeb 28-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix issues in GenericPlayer destruction

Added a preDestroy() mechanism for the subclasses of
GenericPlayer.
Added a lock around the update and use of the callback
GenericPlayer is using for notifications to the
OpenSL ES framework. This prevents notifications after
the GenericPlayer is flagged for destruction.
Added a lock to protect the update of the audio source
running state, so it doesn't get used after the
AudioSfDecoder is flagged for destruction.
Before stopping the audio source of an AudioSfDecoder
object, release the code buffer if necessary, to
ensure proper teardown of the audio source (OMXCodec)

Change-Id: I6cf08d169a6da622552dda5101dbc61e663ce6aa
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
7f5cc1afe49395fefaad9b2bbd728a45d1bfda6a 16-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES: additional features when decoding to PCM

Support the following features useful when decoding a compressed
asset to PCM:
- GetDuration in SLPlayItf
- implemented SLMetadataExtractionItf on an AudioPlayer whose
data sink is a buffer queue (i.e. it's a decoder)
- added support for 6 new metadata keys that can be queried
through SLMetadataExtractionItf, which match the fields
of the SLDataFormat_PCM structure.
Updated the decode sample code to use these features: the
slesTestDecodeToBuffQueue app now displays:
- the number of channels
- the channel mask
- the sample size
- the container size
- the sample rate
- the format endianness

Change-Id: I3ca1e29828fd8c16c89da43a28df429c9cdef7af
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
7ef5526a7bd12eccfa777cc8bc167794634f405a 13-Apr-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix stuttering at beginning of playback

When an AudioPlayer is created, its playstate is set to STOPPED
three times. A stop command is translated into a pause + seek(0).
When a seek is underway, any new seek command was postponed. So
when playback would start after a first seek(0), the other seeks
would be executed, causing the stutterring.
This CL verifies that, when seeking to a certain time, any new
seek command to the same point in time received while seeking
is ignored.
It also correct the update of mStateFlags, which should be done
BEFORE the command is issued to the player, in case the seek
complete notification happens syncronously with the seek command.

This CL does NOT fix why a newly created player sees its playstate
updated to STOPPED three times in a test app like slesTest_playUri
before playback starts.

Change-Id: Ic7627678735f559b911ea3c5a0e1e00d7d7534d2
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
e31a69fcbe27894a597176d05a08e04c06092021 13-Apr-2011 Glenn Kasten <gkasten@google.com> Fix various bugs found with unit tests

ISeek::SetLoop was returning undefined status.
Khronos Bug 7614 - sizeof(long) != 32 bits on x86_64.
Fix bug in IID hashing due to the above.
Fix bug in GenericMediaPlayer::onLoop; was using mPlayer without checking for NULL.
Fix wrong API level in tests/sandbox/object.c.
Decrease log level from I to V in MediaPlayerNotificationClient::notify
and GenericPlayer::~GenericPlayer.
Fix memory leak in tests/sandbox/engine.c.
Comment out overly verbose log in tests/sandbox/streamSource/slesTestPlayStream.cpp.

Change-Id: I322fa9e19ee95ea1e18870a20f6a3c03b8f21208
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
4ee246c55533bdab8ab5fa0f0581744fe58e7c91 29-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Move support for SL URI and FD playback under GenericPlayer class

The SfPlayer class was implementing URI and FD decode and playback
in the application process. This CL removes this class entirely
and moves its functionality under the GenericPlayer class. This
means that the playback of URIs and FDs is now implemented through
an android::MediaPlayer object running in the media service.

The SfPlayer header had many StageFright and system includes, which
are now moved to the relevant files where they are required,
instead of automagically coming from sles_allinclusive.h.

Note that this CL breaks support for the following OpenSL ES features
due to missing Android MediaPlayer features:
SLPlayItf.GetPosition
HEADATMARKER
HEADATNEWPOSITION
SLVolumeItf.EnableStereoPosition
SetStereoPosition
SLMuteSoloItf
SLPlaybackRateItf

Support for those features will be reintegrated in subsequent CLs.

Change-Id: I8d7f6ea006eb7b876ef1ca1909d74b4517335850
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
e9236d046fdb5cac0696c42e03443a2439188146 16-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 clean logs, PTS should be unsigned

- Don't pollute logs.
- Save MPEG-2 PTS as an unsigned 64bit value, negative values are
invalid.

Change-Id: I51d427789dd1e42219a63c68159f2e28628f0448
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
37dc2fccf3f122b79ebd554de209d0a3c94ae161 09-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 Implement streamInformation and volume in OpenMAX AL

- Implement StreamInformation for video size notification.
- Implement the XAVolumeItf for volume control
- Fix bug in GUID -> MPH hash.
- Fixed typo in GenericPlayer::pause() log
- Do not signal a discontinuity automatically when the ABQ is
cleared because clearing the queue doesn't imply there will
be a discontinuity in the data (e.g. the same data that was
cleared could be reenqueued)
- In "native-media" test app: add test code to exercise the
XAVolumeItf functionality.

Change-Id: I9f69f8cacbdce51b6d96d60141ec1d0f645df991
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
70c49ae2867094072a4365423417ea452bf82231 07-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 support commands in SLAndroidBufferQueueItf

Support for EOS, DISCONTINUITY, and DISCONTINUITY with
a PTS.

- in IAndroidBufferQueue structure, added buffer type
- modified AdvancedBufferHeader structure to have a buffer
type-specific structure that contains all the items for each
buffer
- added parsing of items when enqueueing a buffer
- enforce buffer size enqueue to be a multiple of MPEG-2 TS
block size for buffer of the corresponding types
- when enqueueing a buffer on an empty queue, implemented
an asynchronous notification on StreamPlayer to consume
the newly queued buffer. Verified this kicks off playback
after having starved the framework for buffers.
- report unknown duration when using AndroidBufferQueue

Change-Id: I9bde97a6c6ffca7d376b4963313b820b35f50a26
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp
13837cf3f7be0eb8b1a9552bd99a89f98c987720 01-Feb-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES: support decode to PCM buffer queue

Created a new audio player class, APlayer, from which we derive
subclasses to encapsulate OpenSL ES AudioPlayer implementations:
- ASfPlayer derives from APlayer and encapsulates StageFright
functionality for audio decoding to a buffer
- ADecoder derives from ASfPlayer and encapsulates rendering
the decoded audio data to a callback function. It interfaces
with the OpenSL ES Buffer Queue interface to pass the decoded
data back to an OpenSL ES application.

For OpenSL ES, to support decoding to a Buffer Queue, we now
allow an AudioPlayer to have its sink be a PCM buffer queue.

Change-Id: I9aefeb0375a71f7ca770c5c62b4fb8faf59c9c23
/frameworks/wilhelm/src/android/android_GenericPlayer.cpp