diff options
author | Steve Kondik <steve@cyngn.com> | 2014-01-31 22:08:54 +0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-07 12:03:16 -0800 |
commit | e79ee6494c2a1f2d3b1f1b1393ca85beee41a29d (patch) | |
tree | 26430e8fe59a53da3d0161b6123b575bef05b49e /include/media | |
parent | 5d9ec7585ad39f73690fddbd864f3e3f5c1bde4d (diff) | |
download | frameworks_av-e79ee6494c2a1f2d3b1f1b1393ca85beee41a29d.zip frameworks_av-e79ee6494c2a1f2d3b1f1b1393ca85beee41a29d.tar.gz frameworks_av-e79ee6494c2a1f2d3b1f1b1393ca85beee41a29d.tar.bz2 |
stagefright: Squashed commit of pause/resume features
Add 2 APIs (suspend/resume) in MediaPlayer
- API:suspend() will just pause the player and release all the decoders
to replace release() which will release the whole player
- API:resume() will just init the decoders again,
then start() will be called to restart streaming playback
- Add a check in AwesomePlayer::onVideoEvent()
to make sure the first seek operation will always seek to the next
i-frame
Change-Id: Ie4c82906a2a056378119921a656128ebdc1007c4
audio: Add pause support for hardware omx component
- ADSP doesn't enter sleep state after wma playback is paused
and power suspended.
- No support for NT session pause in case of hardware component.
NT session need to be paused to put ADSP into power collapse.
- Add support of pause in stagefright to ensure device enters
suspend mode. Also add intermediate states to avoid concurrency
issues between read and pause.
Change-Id: I41b946b8c8805e6ee303646b63513b5b16514ef6
libstagefright: Drain input buffer on resume
- Buffers returned from codec in paused state are not drained. When
codec is resumed these buffers are not drained until the next flush,
and may cause timed out issue.
- Added change to drain input buffers for sw decoders when resuming.
Change-Id: Ida2ab1d5dc3a1910accdd6fb89548262a912d8e7
CRs-Fixed: 569585, 574967
libstagefright: camcorder pause-resume implementation
- Add pause resume feature in camcorder app. So that
user can pause recording and resume later which results
in a single recorded clip.
Change-Id: Id19c45ae5bb85265aa4d5304b160ebf119d9575a
libstagefright: support pause/resume for timelapse recording
Modify the timestamp calculation mechanism in CameraSourceTimeLapse
in order to support pause/resume.
Change-Id: Icb02ea798b0b807ffb7ada2d1ef5b2414b74edfb
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/IMediaPlayer.h | 10 | ||||
-rw-r--r-- | include/media/IMediaRecorder.h | 1 | ||||
-rw-r--r-- | include/media/MediaPlayerInterface.h | 8 | ||||
-rw-r--r-- | include/media/MediaRecorderBase.h | 1 | ||||
-rw-r--r-- | include/media/mediaplayer.h | 5 | ||||
-rwxr-xr-x | include/media/mediarecorder.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/AudioPlayer.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/AudioSource.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/CameraSource.h | 7 | ||||
-rw-r--r-- | include/media/stagefright/CameraSourceTimeLapse.h | 3 | ||||
-rw-r--r-- | include/media/stagefright/OMXCodec.h | 4 |
11 files changed, 46 insertions, 3 deletions
diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index 0fd8933..5957535 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -109,6 +109,16 @@ public: virtual status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata) = 0; + + // Suspend the video player + // In other words, just release the audio decoder and the video decoder + // @return OK if the video player was suspended successfully + virtual status_t suspend() = 0; + + // Resume the video player + // Init the audio decoder and the video decoder + // @return OK if the video player was resumed successfully + virtual status_t resume() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h index 77ed5d3..339bd9e 100644 --- a/include/media/IMediaRecorder.h +++ b/include/media/IMediaRecorder.h @@ -51,6 +51,7 @@ public: virtual status_t prepare() = 0; virtual status_t getMaxAmplitude(int* max) = 0; virtual status_t start() = 0; + virtual status_t pause() = 0; virtual status_t stop() = 0; virtual status_t reset() = 0; virtual status_t init() = 0; diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index 745151b..4810b7e 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -267,6 +267,14 @@ public: return INVALID_OPERATION; } + virtual status_t suspend() { + return INVALID_OPERATION; + } + + virtual status_t resume() { + return INVALID_OPERATION; + } + private: friend class MediaPlayerService; diff --git a/include/media/MediaRecorderBase.h b/include/media/MediaRecorderBase.h index d6cc4bb..48d8b70 100644 --- a/include/media/MediaRecorderBase.h +++ b/include/media/MediaRecorderBase.h @@ -53,6 +53,7 @@ struct MediaRecorderBase { virtual status_t prepare() = 0; virtual status_t start() = 0; virtual status_t stop() = 0; + virtual status_t pause() = 0; virtual status_t close() = 0; virtual status_t reset() = 0; virtual status_t getMaxAmplitude(int *max) = 0; diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 1f6ddad..3d4a6e2 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -147,7 +147,8 @@ enum media_player_states { MEDIA_PLAYER_STARTED = 1 << 4, MEDIA_PLAYER_PAUSED = 1 << 5, MEDIA_PLAYER_STOPPED = 1 << 6, - MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7 + MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7, + MEDIA_PLAYER_SUSPENDED = 1 << 8 }; // Keep KEY_PARAMETER_* in sync with MediaPlayer.java. @@ -255,6 +256,8 @@ public: status_t getParameter(int key, Parcel* reply); status_t setRetransmitEndpoint(const char* addrString, uint16_t port); status_t setNextMediaPlayer(const sp<MediaPlayer>& player); + status_t suspend(); + status_t resume(); private: void clear_l(); diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index 93b5d67..96c84bb 100755 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -134,6 +134,9 @@ enum media_recorder_states { // Recording is in progress. MEDIA_RECORDER_RECORDING = 1 << 4, + + // Recording is paused. + MEDIA_RECORDER_PAUSED = 1 << 5, }; // The "msg" code passed to the listener in notify. @@ -246,6 +249,7 @@ public: status_t getMaxAmplitude(int* max); virtual status_t start(); virtual status_t stop(); + virtual status_t pause(); status_t reset(); status_t init(); status_t close(); diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h index e0cd965..edc9f25 100644 --- a/include/media/stagefright/AudioPlayer.h +++ b/include/media/stagefright/AudioPlayer.h @@ -103,6 +103,7 @@ private: int64_t mSeekTimeUs; bool mStarted; + bool mSourcePaused; bool mIsFirstBuffer; status_t mFirstBufferResult; @@ -115,6 +116,7 @@ private: bool mPlaying; int64_t mStartPosUs; const uint32_t mCreateFlags; + bool mPauseRequired; static void AudioCallback(int event, void *user, void *info); void AudioCallback(int event, void *info); diff --git a/include/media/stagefright/AudioSource.h b/include/media/stagefright/AudioSource.h index 9750bcd..e48765e 100644 --- a/include/media/stagefright/AudioSource.h +++ b/include/media/stagefright/AudioSource.h @@ -46,7 +46,7 @@ struct AudioSource : public MediaSource, public MediaBufferObserver { virtual status_t stop() { return reset(); } virtual sp<MetaData> getFormat(); - virtual status_t pause() { return ERROR_UNSUPPORTED; } + virtual status_t pause(); // Returns the maximum amplitude since last call. int16_t getMaxAmplitude(); @@ -94,6 +94,8 @@ protected: int64_t mNumFramesReceived; int64_t mNumClientOwnedBuffers; + bool mRecPaused; + List<MediaBuffer * > mBuffersReceived; void trackMaxAmplitude(int16_t *data, int nSamples); diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 527ee15..70149cc 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -92,7 +92,7 @@ public: virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); - virtual status_t pause() { return ERROR_UNSUPPORTED; } + virtual status_t pause(); /** * Check whether a CameraSource object is properly initialized. @@ -208,6 +208,11 @@ protected: bool mCollectStats; bool mIsMetaDataStoredInVideoBuffers; + int64_t mPauseAdjTimeUs; + int64_t mPauseStartTimeUs; + int64_t mPauseEndTimeUs; + bool mRecPause; + void releaseQueuedFrames(); void releaseOneRecordingFrame(const sp<IMemory>& frame); diff --git a/include/media/stagefright/CameraSourceTimeLapse.h b/include/media/stagefright/CameraSourceTimeLapse.h index f264d98..eeb453f 100644 --- a/include/media/stagefright/CameraSourceTimeLapse.h +++ b/include/media/stagefright/CameraSourceTimeLapse.h @@ -67,6 +67,9 @@ protected: // Real timestamp of the last encoded time lapse frame int64_t mLastTimeLapseFrameRealTimestampUs; + // Adjusted continuous timestamp based on recording fps + // of the last encoded time lapse frame + int64_t mLastTimeLapseFrameTimeStampUs; // Variable set in dataCallbackTimestamp() to help skipCurrentFrame() // to know if current frame needs to be skipped. diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 7fabcb3..ea534e0 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -139,6 +139,9 @@ private: EXECUTING_TO_IDLE, IDLE_TO_LOADED, RECONFIGURING, + PAUSING, + FLUSHING, + PAUSED, ERROR }; @@ -348,6 +351,7 @@ private: status_t waitForBufferFilled_l(); + status_t resumeLocked(bool drainInputBuf); int64_t getDecodingTimeUs(); status_t parseHEVCCodecSpecificData( |