Set bitrate for encoder
[platform/core/api/mediacodec.git] / src / media_codec_port.c
index 70b5cc3..cadd8e6 100644 (file)
@@ -171,8 +171,10 @@ int mc_set_vdec_info(MMHandleType mediacodec, int width, int height)
                return MC_INVALID_ARG;
        }
 
-       if (!_check_support_video_info(mc_handle->codec_id, width, height))
+       if (!_check_support_video_info(mc_handle->codec_id, width, height)) {
+               LOGE("invaild param[res %dx%d]", width, height);
                return MC_PARAM_ERROR;
+       }
 
        MEDIACODEC_CHECK_CONDITION(mc_handle->codec_id && mc_handle->is_video && !mc_handle->is_encoder,
                        MC_INVALID_ARG, "MEDIACODEC_ERROR_INVALID_PARAMETER");
@@ -195,8 +197,10 @@ int mc_set_venc_info(MMHandleType mediacodec, int width, int height, int fps, in
                return MC_INVALID_ARG;
        }
 
-       if (!_check_support_video_info(mc_handle->codec_id, width, height) || fps < 0 || target_bits < 0)
+       if (!_check_support_video_info(mc_handle->codec_id, width, height) || fps < 0 || target_bits < 0) {
+               LOGE("invaild param[res %dx%d, fps %d, target_bits %d]", width, height, fps, target_bits);
                return MC_PARAM_ERROR;
+       }
 
        MEDIACODEC_CHECK_CONDITION(mc_handle->codec_id && mc_handle->is_video && mc_handle->is_encoder,
                        MC_INVALID_ARG, "MEDIACODEC_ERROR_INVALID_PARAMETER");
@@ -220,8 +224,10 @@ int mc_set_adec_info(MMHandleType mediacodec, int samplerate, int channel, int b
                return MC_INVALID_ARG;
        }
 
-       if (!_check_support_audio_info(mc_handle->codec_id, samplerate, channel, bit))
+       if (!_check_support_audio_info(mc_handle->codec_id, samplerate, channel, bit)) {
+               LOGE("invaild param[samplerate %d, channel %d, bit %d]", samplerate, channel, bit);
                return MC_PARAM_ERROR;
+       }
 
        MEDIACODEC_CHECK_CONDITION(mc_handle->codec_id && !mc_handle->is_video && !mc_handle->is_encoder,
                        MC_INVALID_ARG, "MEDIACODEC_ERROR_INVALID_PARAMETER");
@@ -244,8 +250,10 @@ int mc_set_aenc_info(MMHandleType mediacodec, int samplerate, int channel, int b
                return MC_INVALID_ARG;
        }
 
-       if (!_check_support_audio_info(mc_handle->codec_id, samplerate, channel, bit))
+       if (!_check_support_audio_info(mc_handle->codec_id, samplerate, channel, bit) || bitrate < 0) {
+               LOGE("invaild param[samplerate %d, channel %d, bit %d, bitrate %d]", samplerate, channel, bit, bitrate);
                return MC_PARAM_ERROR;
+       }
 
        MEDIACODEC_CHECK_CONDITION(mc_handle->codec_id && !mc_handle->is_video && mc_handle->is_encoder,
                        MC_INVALID_ARG, "MEDIACODEC_ERROR_INVALID_PARAMETER");