From 94ea60f975c3eb7ce6d2a4430538a42a5fc3babd Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Tue, 14 May 2013 15:52:03 +0100 Subject: stagefright: offload playback support Offloading of compressed audio decoding to audio DSP is implemented for audio only, non streamed content. when the datasource is AudioPlayer: - Create an offloaded sink when playing a compressed source - Send metadata to audio HAL - Return sink start error to AwesomePlayer so that a new player for PCM audio can be created in case of problem. - Forward stream end and tear down callback events to AwesomePlayer - Stop the sink and wait for stream end callback when EOS is reached. - Pause and restart the sink if needed before flushing when seeking (otherwise flush is a no op). - For current media time, directly query the render position from the sink and offset by the start position (seek to time) AwesomePlayer: - When initializing the audio decoder, check with audio policy manager if offloading is supported. If yes, create the software decoder in case a reconfiguration is needed but connect the audio track directly to the AudioPlayer. - In case of error when starting the AudioPlayer, reconnect the software decoder (OMXSource) and recreate a PCM AudioPlayer. - Handle AudioPlayer tear down event by detroying and recreating the AudioPlayer to allow transitions between situations were offloading is supported or not. - Force tear down of offloaded AudioPlayer when paused for a certain time: This will close the sink and allow the DSP to power down. Utils: - Added helper methods: - send meta data to audio ia sink setParameters - query audio policy manager if offloading is supported for a given audio content Change-Id: I115842ce424f947b966d45e253a74d3fd5df9aae Signed-off-by: Eric Laurent --- libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp | 3 ++- libvideoeditor/lvpp/VideoEditorAudioPlayer.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'libvideoeditor/lvpp') diff --git a/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp b/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp index dc360a5..176f8e9 100755 --- a/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp +++ b/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp @@ -149,7 +149,7 @@ void VideoEditorAudioPlayer::clear() { mStarted = false; } -void VideoEditorAudioPlayer::resume() { +status_t VideoEditorAudioPlayer::resume() { ALOGV("resume"); AudioMixSettings audioMixSettings; @@ -180,6 +180,7 @@ void VideoEditorAudioPlayer::resume() { } else { mAudioTrack->start(); } + return OK; } status_t VideoEditorAudioPlayer::seekTo(int64_t time_us) { diff --git a/libvideoeditor/lvpp/VideoEditorAudioPlayer.h b/libvideoeditor/lvpp/VideoEditorAudioPlayer.h index d2e652d..2caf5e8 100755 --- a/libvideoeditor/lvpp/VideoEditorAudioPlayer.h +++ b/libvideoeditor/lvpp/VideoEditorAudioPlayer.h @@ -58,7 +58,7 @@ public: status_t start(bool sourceAlreadyStarted = false); void pause(bool playPendingSamples = false); - void resume(); + status_t resume(); status_t seekTo(int64_t time_us); bool isSeeking(); bool reachedEOS(status_t *finalStatus); -- cgit v1.1