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

Commit eac5b6f4 authored by Shalaj Jain's avatar Shalaj Jain Committed by Ricardo Cerqueira
Browse files

libstagefright: Set high frame rate encoding flag to 0 by default

- Set the hfr flag to be 0 by default
- Do not crash if the meta contains no value for kKeyHFR

CRs-Fixed: 332372
(cherry picked from commit 6712b25b7e600cf29e2940fa61ec5bacf4f1c879)

Change-Id: Ie6cfa21f3df2114dee335b70412f1239cf6376ec

Conflicts:

	media/libstagefright/OMXCodec.cpp
parent ed91abeb
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1296,7 +1296,7 @@ void OMXCodec::setVideoInputFormat(

    int32_t width, height, frameRate, bitRate, stride, sliceHeight;
#ifdef QCOM_HARDWARE
    int32_t hfr;
    int32_t hfr = 0;

    char value[PROPERTY_VALUE_MAX];
    if ( property_get("encoder.video.bitrate", value, 0) > 0 && atoi(value) > 0){
@@ -1312,7 +1312,7 @@ void OMXCodec::setVideoInputFormat(
    success = success && meta->findInt32(kKeyStride, &stride);
    success = success && meta->findInt32(kKeySliceHeight, &sliceHeight);
#ifdef QCOM_HARDWARE
    success = success && meta->findInt32(kKeyHFR, &hfr);
    meta->findInt32(kKeyHFR, &hfr);
#endif
    CHECK(success);
    CHECK(stride != 0);
@@ -1556,13 +1556,13 @@ status_t OMXCodec::getVideoProfileLevel(
status_t OMXCodec::setupH263EncoderParameters(const sp<MetaData>& meta) {
    int32_t iFramesInterval, frameRate, bitRate;
#ifdef QCOM_HARDWARE
    int32_t hfr;
    int32_t hfr = 0;
#endif
    bool success = meta->findInt32(kKeyBitRate, &bitRate);
    success = success && meta->findInt32(kKeyFrameRate, &frameRate);
    success = success && meta->findInt32(kKeyIFramesInterval, &iFramesInterval);
#ifdef QCOM_HARDWARE
    success = success && meta->findInt32(kKeyHFR, &hfr);
    meta->findInt32(kKeyHFR, &hfr);
#endif
    CHECK(success);
    OMX_VIDEO_PARAM_H263TYPE h263type;
@@ -1612,13 +1612,13 @@ status_t OMXCodec::setupH263EncoderParameters(const sp<MetaData>& meta) {
status_t OMXCodec::setupMPEG4EncoderParameters(const sp<MetaData>& meta) {
    int32_t iFramesInterval, frameRate, bitRate;
#ifdef QCOM_HARDWARE
    int32_t hfr;
    int32_t hfr = 0;
#endif
    bool success = meta->findInt32(kKeyBitRate, &bitRate);
    success = success && meta->findInt32(kKeyFrameRate, &frameRate);
    success = success && meta->findInt32(kKeyIFramesInterval, &iFramesInterval);
#ifdef QCOM_HARDWARE
    success = success && meta->findInt32(kKeyHFR, &hfr);
    meta->findInt32(kKeyHFR, &hfr);
#endif
    CHECK(success);
    OMX_VIDEO_PARAM_MPEG4TYPE mpeg4type;
@@ -1673,12 +1673,13 @@ status_t OMXCodec::setupMPEG4EncoderParameters(const sp<MetaData>& meta) {
status_t OMXCodec::setupAVCEncoderParameters(const sp<MetaData>& meta) {
    int32_t iFramesInterval, frameRate, bitRate;
#ifdef QCOM_HARDWARE
    int32_t hfr;
    int32_t hfr = 0;
#endif
    bool success = meta->findInt32(kKeyBitRate, &bitRate);
    success = success && meta->findInt32(kKeyFrameRate, &frameRate);
    success = success && meta->findInt32(kKeyIFramesInterval, &iFramesInterval);
#ifdef QCOM_HARDWARE
    meta->findInt32(kKeyHFR, &hfr);
    success = success && meta->findInt32(kKeyHFR, &hfr);
#endif
    CHECK(success);