mm-video-v4l2: vdec: Fix sanity check in log_output_buffers.

Refactor sanity check in log_output_buffers.

Change-Id: I4126fde80556551d17cd79a52e011daf4c5e4328
This commit is contained in:
Abdulla Anam 2016-12-14 12:07:25 +05:30 committed by Gerrit - the friendly Code Review server
parent 42db0ef27e
commit 232da1544d

View file

@ -2042,7 +2042,10 @@ int omx_vdec::log_output_buffers(OMX_BUFFERHEADERTYPE *buffer) {
int buf_index = 0;
char *temp = NULL;
if (m_debug.out_buffer_log && !m_debug.outfile && buffer->nFilledLen) {
if (!(m_debug.out_buffer_log || m_debug.out_meta_buffer_log) || !buffer || !buffer->nFilledLen)
return 0;
if (m_debug.out_buffer_log && !m_debug.outfile) {
snprintf(m_debug.outfile_name, OMX_MAX_STRINGNAME_SIZE, "%s/output_%d_%d_%p.yuv",
m_debug.log_loc, drv_ctx.video_resolution.frame_width, drv_ctx.video_resolution.frame_height, this);
m_debug.outfile = fopen (m_debug.outfile_name, "ab");
@ -2053,8 +2056,7 @@ int omx_vdec::log_output_buffers(OMX_BUFFERHEADERTYPE *buffer) {
}
}
if (m_debug.out_meta_buffer_log && !m_debug.out_ymeta_file && !m_debug.out_uvmeta_file
&& buffer->nFilledLen) {
if (m_debug.out_meta_buffer_log && !m_debug.out_ymeta_file && !m_debug.out_uvmeta_file) {
snprintf(m_debug.out_ymetafile_name, OMX_MAX_STRINGNAME_SIZE, "%s/output_%d_%d_%p.ymeta",
m_debug.log_loc, drv_ctx.video_resolution.frame_width, drv_ctx.video_resolution.frame_height, this);
snprintf(m_debug.out_uvmetafile_name, OMX_MAX_STRINGNAME_SIZE, "%s/output_%d_%d_%p.uvmeta",
@ -2069,9 +2071,6 @@ int omx_vdec::log_output_buffers(OMX_BUFFERHEADERTYPE *buffer) {
}
}
if ((!m_debug.outfile && !m_debug.out_ymeta_file) || !buffer || !buffer->nFilledLen)
return 0;
buf_index = buffer - m_out_mem_ptr;
temp = (char *)drv_ctx.ptr_outputbuffer[buf_index].bufferaddr;
@ -2117,7 +2116,7 @@ int omx_vdec::log_output_buffers(OMX_BUFFERHEADERTYPE *buffer) {
temp += uv_meta_stride;
}
}
} else if (drv_ctx.output_format == VDEC_YUV_FORMAT_NV12) {
} else if (m_debug.outfile && drv_ctx.output_format == VDEC_YUV_FORMAT_NV12) {
int stride = drv_ctx.video_resolution.stride;
int scanlines = drv_ctx.video_resolution.scan_lines;
if (m_smoothstreaming_mode) {