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 /media/libstagefright/CameraSource.cpp | |
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 'media/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index aea0f13..7652fe2 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -199,7 +199,11 @@ CameraSource::CameraSource( mNumFramesDropped(0), mNumGlitches(0), mGlitchDurationThresholdUs(200000), - mCollectStats(false) { + mCollectStats(false), + mPauseAdjTimeUs(0), + mPauseStartTimeUs(0), + mPauseEndTimeUs(0), + mRecPause(false) { mVideoSize.width = -1; mVideoSize.height = -1; @@ -669,6 +673,14 @@ status_t CameraSource::startCameraRecording() { status_t CameraSource::start(MetaData *meta) { ALOGV("start"); + if(mRecPause) { + mRecPause = false; + mPauseAdjTimeUs = mPauseEndTimeUs - mPauseStartTimeUs; + ALOGV("resume : mPause Adj / End / Start : %lld / %lld / %lld us", + mPauseAdjTimeUs, mPauseEndTimeUs, mPauseStartTimeUs); + return OK; + } + CHECK(!mStarted); if (mInitCheck != OK) { ALOGE("CameraSource is not initialized yet"); @@ -682,6 +694,10 @@ status_t CameraSource::start(MetaData *meta) { } mStartTimeUs = 0; + mRecPause = false; + mPauseAdjTimeUs = 0; + mPauseStartTimeUs = 0; + mPauseEndTimeUs = 0; mNumInputBuffers = 0; mEncoderFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; mEncoderDataSpace = HAL_DATASPACE_BT709; @@ -715,6 +731,16 @@ status_t CameraSource::start(MetaData *meta) { return err; } +status_t CameraSource::pause() { + mRecPause = true; + mPauseStartTimeUs = mLastFrameTimestampUs; + //record the end time too, or there is a risk the end time is 0 + mPauseEndTimeUs = mLastFrameTimestampUs; + ALOGV("pause : mPauseStart %lld us, #Queued Frames : %d", + mPauseStartTimeUs, mFramesReceived.size()); + return OK; +} + void CameraSource::stopCameraRecording() { ALOGV("stopCameraRecording"); if (mCameraFlags & FLAGS_HOT_CAMERA) { @@ -916,6 +942,19 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs, return; } + if (mRecPause == true) { + if(!mFramesReceived.empty()) { + ALOGV("releaseQueuedFrames - #Queued Frames : %d", mFramesReceived.size()); + releaseQueuedFrames(); + } + ALOGV("release One Video Frame for Pause : %lld us", timestampUs); + releaseOneRecordingFrame(data); + mPauseEndTimeUs = timestampUs; + return; + } + timestampUs -= mPauseAdjTimeUs; + ALOGV("dataCallbackTimestamp: AdjTimestamp %lld us", timestampUs); + if (mNumFramesReceived > 0) { if (timestampUs <= mLastFrameTimestampUs) { ALOGW("Dropping frame with backward timestamp %lld (last %lld)", |