From 43ccd58c53e951e3a5ec283711266e5aa9a2ebcc Mon Sep 17 00:00:00 2001 From: "Christopher R. Palmer" Date: Wed, 13 Jan 2016 14:57:45 -0500 Subject: intel: omx: Unbreak SetConfigVideoBitrate Prior to this change the code used uninitialized memory to for the majority of the config. The commit message which added this code suggests that they might not have been using this function other than to pass a test suite? Either way, it can't be a bad change to get the old config as default values rather than using uninitialized memory when calling set config. Change-Id: I1ccec4a4f206f81af3127f442fdb8b0cfdcab1ad --- videocodec/OMXVideoEncoderBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'videocodec') diff --git a/videocodec/OMXVideoEncoderBase.cpp b/videocodec/OMXVideoEncoderBase.cpp index 37f53d2..82cc741 100644 --- a/videocodec/OMXVideoEncoderBase.cpp +++ b/videocodec/OMXVideoEncoderBase.cpp @@ -964,6 +964,13 @@ OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigVideoBitrate(OMX_PTR pStructure){ // CHECK_SET_CONFIG_STATE(); VideoConfigBitRate configBitRate; + if (mVideoEncoder->getConfig(&configBitRate) != ENCODE_SUCCESS) { + /* Ignoring the error here sucks, but prior to this change + * we were just using an uninitialized chunk of memory anyway + * so we aren't making anything worse and it makes this change safer. + */ + LOGW("failed to get IntelBitrate"); + } configBitRate.rcParams.bitRate = mConfigBitrate.nEncodeBitrate; configBitRate.rcParams.temporalID = 0; retStatus = mVideoEncoder->setConfig(&configBitRate); -- cgit v1.2.3