summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2019-11-06 14:08:16 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-11-06 14:08:16 -0800
commit61c48365565eb1f772e8429a5c18d0517add6149 (patch)
treea821eb5730feb91f2d19c931ac08f2b234a63c18
parent2cdb256fd8776554b740a5e6a9a111bdfb6b5cec (diff)
parent4044134a52e78f2e14a274593775fc709a3c8705 (diff)
Merge "mm-video-v4l2: venc: add checks to disallow implicit B-frames"
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 0e080baa..aed460bd 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -2464,7 +2464,7 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index,
struct v4l2_buffer buf;
struct v4l2_requestbuffers bufreq;
struct v4l2_plane plane[VIDEO_MAX_PLANES];
- int rc = 0, extra_idx;
+ int rc = 0, extra_idx, c2d_enabled = 0;
OMX_U32 extradata_index;
bool interlace_flag = false;
struct OMX_BUFFERHEADERTYPE *bufhdr;
@@ -2847,6 +2847,7 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index,
// color_format == 1 ==> RGBA to YUV Color-converted buffer
// Buffers color-converted via C2D have 601 color
if (!streaming[OUTPUT_PORT]) {
+ c2d_enabled = 1;
DEBUG_PRINT_HIGH("Setting colorspace 601 for Color-converted buffer");
venc_set_colorspace(MSM_VIDC_BT601_6_625, color_space.range,
MSM_VIDC_TRANSFER_601_6_525, MSM_VIDC_MATRIX_601_6_525);
@@ -2878,6 +2879,18 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index,
buf_type=V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
int ret;
+ // Some 3rd APPs use NativeRecorder to implement their applications
+ // like screenrecorder, implicitly enable B-frame may cause issues.
+ // So disallow implicit B-frame when input format is non-UBWC or RGBA(c2d enabled).
+ if ((m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_TP10_UBWC &&
+ m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_UBWC) || c2d_enabled) {
+ DEBUG_PRINT_HIGH("Disallow implicitly enable B-frames");
+ if (!set_native_recoder(OMX_FALSE)) {
+ DEBUG_PRINT_ERROR("Failed to set Native Recorder");
+ return false;
+ }
+ }
+
if (!downscalar_enabled) {
OMX_U32 inp_width = 0, inp_height = 0, out_width = 0, out_height = 0;