Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94eda03f authored by James Dong's avatar James Dong Committed by Android Git Automerger
Browse files

am 7fb232c4: Merge "Make sure that key frame is generated for timelapse video...

am 7fb232c4: Merge "Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source." into honeycomb

* commit '7fb232c40cde91d0958be1694db2d97a126b95f9':
  Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source.
parents ac571749 7757f501
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ protected:
    int32_t mNumFramesReceived;
    int64_t mLastFrameTimestampUs;
    bool mStarted;
    int32_t mNumFramesEncoded;

    CameraSource(const sp<ICamera>& camera, int32_t cameraId,
                 Size videoSize, int32_t frameRate,
@@ -189,7 +190,6 @@ private:
    List<int64_t> mFrameTimes;

    int64_t mFirstFrameTimeUs;
    int32_t mNumFramesEncoded;
    int32_t mNumFramesDropped;
    int32_t mNumGlitches;
    int64_t mGlitchDurationThresholdUs;
+4 −0
Original line number Diff line number Diff line
@@ -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<MediaSource> Create(
            const sp<IOMX> &omx,
@@ -192,6 +195,7 @@ private:
    Condition mBufferFilled;

    bool mIsMetaDataStoredInVideoBuffers;
    bool mOnlySubmitOneBufferAtOneTime;

    OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, uint32_t quirks,
             bool isEncoder, const char *mime, const char *componentName,
+8 −0
Original line number Diff line number Diff line
@@ -1239,6 +1239,14 @@ status_t StagefrightRecorder::setupVideoEncoder(
        encoder_flags |= OMXCodec::kHardwareCodecsOnly;
        encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
    }

    // Do not wait for all the input buffers to become available.
    // This give timelapse video recording faster response in
    // receiving output from video encoder component.
    if (mCaptureTimeLapse) {
        encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime;
    }

    sp<MediaSource> encoder = OMXCodec::Create(
            client.interface(), enc_meta,
            true /* createEncoder */, cameraSource,
+1 −1
Original line number Diff line number Diff line
@@ -147,8 +147,8 @@ CameraSource::CameraSource(
      mNumFramesReceived(0),
      mLastFrameTimestampUs(0),
      mStarted(false),
      mFirstFrameTimeUs(0),
      mNumFramesEncoded(0),
      mFirstFrameTimeUs(0),
      mNumFramesDropped(0),
      mNumGlitches(0),
      mGlitchDurationThresholdUs(200000),
+4 −1
Original line number Diff line number Diff line
@@ -491,7 +491,10 @@ bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) {
            }
        }

        if (*timestampUs <
        // Workaround to bypass the first 2 input frames for skipping.
        // The first 2 output frames from the encoder are: decoder specific info and
        // the compressed video frame data for the first input video frame.
        if (mNumFramesEncoded >= 1 && *timestampUs <
                (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenTimeLapseFrameCaptureUs)) {
            // Skip all frames from last encoded frame until
            // sufficient time (mTimeBetweenTimeLapseFrameCaptureUs) has passed.
Loading