History log of /frameworks/wilhelm/src/android/android_GenericMediaPlayer.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9bf773df2b8a0cf788f394c326960bc3a5af7c60 11-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy warnings in wilhelm.

* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: Ib37e6760ba21f92bd03e0f7400e54e28817a89b5
e21f91df7afb1175ddb5b0045ebb0d5338df2535 18-Dec-2012 Andy McFadden <fadden@android.com> Rename ISurfaceTexture and SurfaceTexture

The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to

Bug 7736700

Change-Id: I54f19904e325518a3af8fe23c018d3c0bb6bd807
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
01e4a8ff63523bba5c8f919a72e0adb66daf4b98 26-Feb-2012 Mathias Agopian <mathias@google.com> cleanup includes

Change-Id: Ia98b76b2e0c49ee257e1f31c61c2d6f72a9fe894
b47c7beddecd38ae565d84b72da526843bfdd43e 08-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

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

Bug: 5449033
Change-Id: I584e6f6a3c52308b7a5a5c9980ca429c831f4320
513222822545c3e954176476b263df52a47f43a4 10-Nov-2011 Glenn Kasten <gkasten@google.com> Bug 5201321 recover from mediaserver crash

Add a media player death notifier to recover from media server crashes.
Downgrade some logs.
Destructors should be protected.

Change-Id: I7774733bcb12fc7fbfe237bdbeffca1adde46e78
241b9c06493479dc632a8851097c193b724a2b41 26-Oct-2011 Andreas Huber <andih@google.com> Remove MediaPlayer::setVideoSurface legacy.

Change-Id: I95aa181f39b375087b30ac65fea37589108c9f16
a0fa47f72f47fffb80ab2ae791739ce73de1e8f4 12-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5293383 ~StreamSourceAppProxy wasn't reached

Fix bug where StreamSourceAppProxy destructor wasn't reached,
which caused all sorts of other problems later on. To see this,
enable the logs StreamSourceAppProxy::~StreamSourceAppProxy and
StreamPlayer::~StreamPlayer. You'll see that StreamPlayer was destroyed,
but not StreamSourceAppProxy.

As StreamSourceAppProxy is child of StreamPlayer, make the reference
from StreamSourceAppProxy to StreamPlayer a weak reference in case
StreamSourceAppProxy's lifetime exceeds StreamPlayer. It is not supposed
to any more with this fix, but the wp<> provides extra safety.

StreamPlayer preDestroy no longer bypasses the preDestroy in

Do a full disconnect in GenericMediaPlayer::preDestroy.

Push decremented reference counts for strong pointer through binder
to workaround binder's "optimization".

Extra error-checking in setListener and setBuffers to verify
that mediaserver is calling them correctly.

Use mutex mLock consistently in StreamSourceAppProxy.

Add an explicit StreamSourceAppProxy::disconnect to break
a circular reference, and call it in StreamPlayer destructor.

Make methods private: receivedCmd_l and receivedBuffer_l.

Add explicit clear during preDestroy to give up references earlier.

Warning: setDataSource(NULL) is not supported by NuPlayer yet,
this depends on another change in frameworks/base, so it is
commented out for now.

Rename mPlayerPrepared to mPreparedPlayer to avoid confusion with the
enum mPlayerPrepared.

Change-Id: Ie5f554c206027d22204eb86edd15489c6281b512
91ff087fb814063f9faa23ab37a61e8fe4e38f45 16-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5334969 MediaPlayerNotificationClient safety

Fixed race due to missing mutex around 2 updates to mPlayerPrepared.

MediaPlayerNotificationClient had a raw reference to GenericMediaPlayer;
if for some reason the binder thread out-lived the GenericMediaPlayer,
then it might reference a destroyed object. Made it a weak reference,
and issue warning if the GenericMediaPlayer has been destroyed.
This has similar effect as a callback protector.

Minor related:
- mHasVideo is read without mutex, safe since never changed but make it const
- GenericMediaPlayer's reference to MediaPlayerNotificationClient is now const also

Change-Id: I67b50e861a055c73fd490fb537a3d6d23d25c3d2
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
b238f3ed65f3fa2a3adad602a438fbc98b13cba3 19-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5126938 dependency for video sinks"
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.

- Remove unused field Parcel metadatafilter

Change-Id: I451a64bd76b4a7f157774abe967448ec081f1014
35ac702ee1ad91e5c8748c12450222d50b366a52 08-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5126938 dependency for video sinks

Fixing bug 5126938 will involve configuring the video sink in two places:
at the initial data locator when creating the MediaPlayer object, and
then later in the IAndroidConfiguration interface. This CL is preparation
for that.

- Abstract out common code into android_Player_setNativeWindow.
- Move the code for checking and initializing the video sink from an
#ifdef ANDROID in the CMediaPlayer_Realize portable code to into
platform-specific android_Player_realize.
- Only set one of mSurface or mSurfaceTexture to non-NULL.
- For methods which can't fail, replace the SLresult return value by void.

Change-Id: Iec8fd91e1a6de45eb64241b35e3f7d7faf63d727
1b65b2054448050ded9e1475df7b755421a1e2da 05-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5903270 play interface, events, markers, etc."
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.

- Get position is now synchronous and (mostly) lock-free
- Fix SMP races in GetPlayState, GetCallbackEventsMask, GetMarkerPosition,
- 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
f6445d330c05ccc57d1adcc6ee05735a33f78881 03-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5110581 SL_PLAYEVENT_HEADATEND while looping

Change-Id: Ia4d0433b4a6589bfda2f88addbe5b7eb3d0d9789
06059e5ee1eaf907589c7f8d1320253f92211348 29-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5092976 no spurious callbacks on prefetch fail

Change-Id: I754085b4d1e43c4d10bea36e0fb683d8113844e9
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
49935c51fddcd0caa0030e2aac0c3a7ba3339e3d 21-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5047695 Handle unsuccessful prepare up to app

Change-Id: I9f1541b37ad5cda21dc49388e42c7fb08b22fc5b
35a5a30fdad179ccf38d8d756590411326159a89 12-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Implement XAPlayItf::GetPosition on MediaPlayer

The play interface was only in place for routing calls to an
AudioPlayer in OpenSL ES, not in OpenMAX AL for a MediaPlayer.

Change-Id: Icf514be428396264252874faf1060c76ddee9545
4b0e0b2860ffd5e246b42c8a434833cca2f068b3 08-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Implement GetPosition for players playing from a URI/FD

AudioPlayer (OpenSL ES) and MediaPlayer (OpenMAX AL) that play
media from a URI or FD are implemented on top of an Android
MediaPlayer. This CL implements requesting the current position
from the underlying MediaPlayer object inside the event loop.
At this stage, GetPosition cannot be called from inside a
callback as the callback is made on the same thread that will
process the asynchronous part of the GetPosition implementation.
Add test app for GetPosition.

Change-Id: Ife768bc40e37fc60cc19f6ba84bbe6cb06cc6590
2f6d462d89356cdaa77299ca27b60c5cca198d98 14-Apr-2011 Gloria Wang <gwang@google.com> - Add another parameter in notify() to be able to send timed text sample
through listener during video playback.
For feature request 800939.

Change-Id: I14aa18d2f803163a62c05f9e6bd990518c58cd3f
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
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:

Support for those features will be reintegrated in subsequent CLs.

Change-Id: I8d7f6ea006eb7b876ef1ca1909d74b4517335850
2b06e20ae32388f6e1dfd088d9773c34e6b1cb45 29-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Reduce include noise in SL and XA class definitions

In classes.h: we should only have to include the headers
for the objects that are actually stored as member variables of
the OpenSL ES and OpenMAX AL objects (so here AudioTrackProtector,
Effect, and GenericPlayer).
In CMediaPlayer.c: remove useless includes and change the video
surface function prototypes to use const refs to strong pointers
instead of pointers to access the GenericMediaPlayer objects.

Note that android_SfPlayer.h is still in sles_allinclusive.h because
it will be dealt with when the SfPlayer functionality is absorbed
under LocAVPlayer.

Change-Id: Ic2c9459862588399d9545a247cc15341effc0f66
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
ad1ab1d13a9b043202b9d5cdc1d8c4ef66cbbca8 05-Mar-2011 Glenn Kasten <gkasten@google.com> Bug 3329759 Surface texture as video sink

XA_DATALOCATOR_NATIVEDISPLAY now allows either a Surface or SurfaceTexture
together with a JNIEnv *.

Miscellaneous fixes:
- Clarify test button labels.
- Line length 100.

Change-Id: I3f3c604dfda3cf66ef7d7adc8689564a83623b2f
68d56b8ebaf60184a3aef988e3d2b09ed8b88c05 24-Feb-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenMAX AL: consolidate MediaPlayer implementations under superclass

The OpenMAX AL MediaPlayer object has two implementations: one
for playing from URI/FD (LocAVPlayer) and one for playing from
AndroidBufferQueue (StreamPlayer). They both inherit from AVPlayer.
This CL makes LocAVPlayer and StreamPlayer inherit from
GenericMediaPlayer (new name of AVPlayer) which encapsulates the
interaction with an android::MediaPlayer instance running in
the media server process.
Also it makes GenericMediaPlayer inherit from GenericPlayer, the
player superclass also used in OpenSL ES.

After this CL, the OpenMAX AL and OpenSL ES have a common class
hierarchy for their players.

Change-Id: I5f6e279fc29b7f6f26c9ed5c83a9455cfda88ff4