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

Commit 9ab8b5d2 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Ricardo Cerqueira
Browse files

libmediaplayerservice: Enable b-frame recording

- put back setupMPEG4EncodeParmaters call.
- Set nBFrames field to 1 for index OMX_IndexParamVideoMpeg4 and OMX_IndexParamVideoAVC
  depending on the recording profile.
- setprop encoder.video.profile depending on the format
- for H.264, set to one of base, main, high
- for MPEG4, set to one of simple, asp

Change-Id: I7b7647da76390a1adca62d7ef2c8d92365c79e01

Conflicts:

	media/libmediaplayerservice/StagefrightRecorder.cpp
parent eac5b6f4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1846,6 +1846,9 @@ status_t MPEG4Writer::Track::threadEntry() {
    int64_t timestampUs = 0;
    int64_t cttsDeltaTimeUs = 0;
    bool hasBFrames = false;
#ifdef QCOM_HARDWARE
    hasBFrames = true;
#endif

#if 1
    // XXX: Samsung's video encoder's output buffer timestamp
+16 −0
Original line number Diff line number Diff line
@@ -1544,6 +1544,8 @@ status_t OMXCodec::getVideoProfileLevel(
            // via OMX_SetParameter call.
            profileLevel.mProfile = profile;
            profileLevel.mLevel = level;
            CODEC_LOGV("profile: %d, level %d is supported",
                       profile, level);
            return OK;
        }
    }
@@ -1660,6 +1662,13 @@ status_t OMXCodec::setupMPEG4EncoderParameters(const sp<MetaData>& meta) {
    mpeg4type.eProfile = static_cast<OMX_VIDEO_MPEG4PROFILETYPE>(profileLevel.mProfile);
    mpeg4type.eLevel = static_cast<OMX_VIDEO_MPEG4LEVELTYPE>(profileLevel.mLevel);

#ifdef QCOM_HARDWARE
    if (mpeg4type.eProfile > OMX_VIDEO_MPEG4ProfileSimple) {
        mpeg4type.nAllowedPictureTypes |= OMX_VIDEO_PictureTypeB;
        mpeg4type.nBFrames = 1;
    }
#endif

    err = mOMX->setParameter(
            mNode, OMX_IndexParamVideoMpeg4, &mpeg4type, sizeof(mpeg4type));
    CHECK_EQ(err, (status_t)OK);
@@ -1733,6 +1742,13 @@ status_t OMXCodec::setupAVCEncoderParameters(const sp<MetaData>& meta) {
        h264type.nCabacInitIdc = 0;
    }

#ifdef QCOM_HARDWARE
    if (h264type.eProfile > OMX_VIDEO_AVCProfileBaseline) {
        h264type.nPFrames = setPFramesSpacing(iFramesInterval, frameRate);
        h264type.nBFrames = 1;
    }
#endif

    if (h264type.nBFrames != 0) {
        h264type.nAllowedPictureTypes |= OMX_VIDEO_PictureTypeB;
    }