From 7757f5010a771fb8824b6fdf9788f588a1577e3f Mon Sep 17 00:00:00 2001 From: James Dong Date: Tue, 25 Jan 2011 16:31:28 -0800 Subject: Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source. This will fix the stop failure issue where we have to wait n * time_interval before a key frame can be received by the file writer, where o n is the actual number of buffers advertised by the video encoder o time_interval is the interval settings for timelapse video recording specifying the time distance between neighboring input video frames The fix includes two parts: o OMXCodec will not submit all n buffers at one time, but instead submit one input frame at one time if it become available. o Timelapse camera source made available the first two input frames and do not skip them so that the first compressed output frame data can be received regardless the specified time_interval bug - 3367659 Change-Id: Ia68cc2cb0d71aa7dc54540e9ad82fae911ad530b --- include/media/stagefright/CameraSource.h | 2 +- include/media/stagefright/OMXCodec.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 794355b..4a39fbf 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -158,6 +158,7 @@ protected: int32_t mNumFramesReceived; int64_t mLastFrameTimestampUs; bool mStarted; + int32_t mNumFramesEncoded; CameraSource(const sp& camera, int32_t cameraId, Size videoSize, int32_t frameRate, @@ -189,7 +190,6 @@ private: List mFrameTimes; int64_t mFirstFrameTimeUs; - int32_t mNumFramesEncoded; int32_t mNumFramesDropped; int32_t mNumGlitches; int64_t mGlitchDurationThresholdUs; diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 3251c28..82948cb 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -47,6 +47,9 @@ struct OMXCodec : public MediaSource, // Store meta data in video buffers kStoreMetaDataInVideoBuffers = 32, + + // Only submit one input buffer at one time. + kOnlySubmitOneInputBufferAtOneTime = 64, }; static sp Create( const sp &omx, @@ -192,6 +195,7 @@ private: Condition mBufferFilled; bool mIsMetaDataStoredInVideoBuffers; + bool mOnlySubmitOneBufferAtOneTime; OMXCodec(const sp &omx, IOMX::node_id node, uint32_t quirks, bool isEncoder, const char *mime, const char *componentName, -- cgit v1.1