From 7ea806fb82c7663e79976dd7c01c253cc9924500 Mon Sep 17 00:00:00 2001 From: Surajit Podder Date: Wed, 9 Oct 2013 14:39:05 +0530 Subject: [PATCH 1/5] dashplayer: Send buffering start event conditionally Send buffering start event to application only if video decoder is instantiated. Change-Id: I99465b45b2f68efbd40eada3d03a235bb6694223 --- dashplayer/DashPlayer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dashplayer/DashPlayer.cpp b/dashplayer/DashPlayer.cpp index 653b902..6cf0639 100644 --- a/dashplayer/DashPlayer.cpp +++ b/dashplayer/DashPlayer.cpp @@ -918,8 +918,16 @@ void DashPlayer::onMessageReceived(const sp &msg) { if (what == kWhatBufferingStart) { ALOGE("Source Notified Buffering Start for %s ",mTrackName); if (mBufferingNotification == false) { - mBufferingNotification = true; - notifyListener(MEDIA_INFO, MEDIA_INFO_BUFFERING_START, 0); + if (track == kVideo && mNativeWindow == NULL) + { + ALOGE("video decoder not instantiated, no buffering for video", + mBufferingNotification); + } + else + { + mBufferingNotification = true; + notifyListener(MEDIA_INFO, MEDIA_INFO_BUFFERING_START, 0); + } } else { ALOGE("Buffering Start Event Already Notified mBufferingNotification(%d)", From c26fd2aeb75c47fd032758ca050cf24a11886fa6 Mon Sep 17 00:00:00 2001 From: c_sridur Date: Wed, 9 Oct 2013 19:28:08 +0530 Subject: [PATCH 2/5] Revert "mm-video: vidc: Add support for dynamic debug logging" This reverts commit 4129054ff17269d3a4a277398b922f4a18c73cd4 -This gerrit is causing the power regression (CR:552802). After reverting this change we see improvement of ~79mA. Even the CPU consumption of "VideoDecMsgThre" of /system/bin/mediaserver came down. Change-Id: Ia1947a02a8d4cc3bad528bdc0ac346f0f7d6af93 --- mm-video/vidc/common/inc/extra_data_handler.h | 21 +- mm-video/vidc/common/inc/vidc_debug.h | 61 ---- .../vidc/common/src/vidc_color_converter.cpp | 11 +- mm-video/vidc/vdec/inc/omx_vdec.h | 7 +- mm-video/vidc/vdec/inc/ts_parser.h | 5 +- mm-video/vidc/vdec/src/frameparser.cpp | 11 +- mm-video/vidc/vdec/src/h264_utils.cpp | 265 +++++++++--------- mm-video/vidc/vdec/src/mp4_utils.cpp | 11 +- mm-video/vidc/vdec/src/omx_vdec.cpp | 22 +- mm-video/vidc/vdec/src/ts_parser.cpp | 2 +- mm-video/vidc/venc/inc/omx_video_base.h | 5 +- mm-video/vidc/venc/src/omx_video_encoder.cpp | 5 - 12 files changed, 197 insertions(+), 229 deletions(-) delete mode 100644 mm-video/vidc/common/inc/vidc_debug.h diff --git a/mm-video/vidc/common/inc/extra_data_handler.h b/mm-video/vidc/common/inc/extra_data_handler.h index e1c5ece..d61bb6e 100644 --- a/mm-video/vidc/common/inc/extra_data_handler.h +++ b/mm-video/vidc/common/inc/extra_data_handler.h @@ -42,9 +42,28 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern "C"{ #include } +#ifdef ENABLE_DEBUG_LOW +#define DEBUG_PRINT_LOW ALOGE +#else +#define DEBUG_PRINT_LOW +#endif +#ifdef ENABLE_DEBUG_HIGH +#define DEBUG_PRINT_HIGH ALOGE +#else +#define DEBUG_PRINT_HIGH +#endif +#ifdef ENABLE_DEBUG_ERROR +#define DEBUG_PRINT_ERROR ALOGE +#else +#define DEBUG_PRINT_ERROR +#endif + +#else //_ANDROID_ +#define DEBUG_PRINT_LOW printf +#define DEBUG_PRINT_HIGH printf +#define DEBUG_PRINT_ERROR printf #endif // _ANDROID_ -#include "vidc_debug.h" #define SEI_PAYLOAD_FRAME_PACKING_ARRANGEMENT 0x2D #define H264_START_CODE 0x01 #define NAL_TYPE_SEI 0x06 diff --git a/mm-video/vidc/common/inc/vidc_debug.h b/mm-video/vidc/common/inc/vidc_debug.h deleted file mode 100644 index 1e058ad..0000000 --- a/mm-video/vidc/common/inc/vidc_debug.h +++ /dev/null @@ -1,61 +0,0 @@ -/*-------------------------------------------------------------------------- -copyright (c) 2013, The Linux Foundation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of The Linux Foundation nor - the names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------*/ - -#ifndef __VIDC_DEBUG_H__ -#define __VIDC_DEBUG_H__ - -#ifdef _ANDROID_ -#include - -enum { - PRIO_ERROR=0x1, - PRIO_HIGH=0x2, - PRIO_LOW=0x4 -}; - -extern int debug_level; - -#undef DEBUG_PRINT_ERROR -#define DEBUG_PRINT_ERROR(fmt, args...) \ - if (debug_level & PRIO_ERROR) \ - ALOGE(fmt,##args) -#undef DEBUG_PRINT_LOW -#define DEBUG_PRINT_LOW(fmt, args...) \ - if (debug_level & PRIO_LOW) \ - ALOGD(fmt,##args) -#undef DEBUG_PRINT_HIGH -#define DEBUG_PRINT_HIGH(fmt, args...) \ - if (debug_level & PRIO_HIGH) \ - ALOGD(fmt,##args) -#else -#define DEBUG_PRINT_ERROR printf -#define DEBUG_PRINT_LOW printf -#define DEBUG_PRINT_HIGH printf -#endif - -#endif diff --git a/mm-video/vidc/common/src/vidc_color_converter.cpp b/mm-video/vidc/common/src/vidc_color_converter.cpp index d579b40..db5345f 100644 --- a/mm-video/vidc/common/src/vidc_color_converter.cpp +++ b/mm-video/vidc/common/src/vidc_color_converter.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +Copyright (c) 2012, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -28,7 +28,14 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "vidc_color_converter.h" -#include "vidc_debug.h" +#undef DEBUG_PRINT_LOW +#undef DEBUG_PRINT_HIGH +#undef DEBUG_PRINT_ERROR + +#define DEBUG_PRINT_LOW ALOGV +#define DEBUG_PRINT_HIGH ALOGE +#define DEBUG_PRINT_ERROR ALOGE + omx_c2d_conv::omx_c2d_conv() { c2dcc = NULL; diff --git a/mm-video/vidc/vdec/inc/omx_vdec.h b/mm-video/vidc/vdec/inc/omx_vdec.h index e2128ca..5cbddcb 100644 --- a/mm-video/vidc/vdec/inc/omx_vdec.h +++ b/mm-video/vidc/vdec/inc/omx_vdec.h @@ -69,6 +69,10 @@ extern "C"{ #define LOG_TAG "OMX-VDEC" #endif +#else //_ANDROID_ +#define DEBUG_PRINT_LOW printf +#define DEBUG_PRINT_HIGH printf +#define DEBUG_PRINT_ERROR printf #endif // _ANDROID_ #if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_) @@ -99,7 +103,6 @@ extern "C"{ #include "extra_data_handler.h" #include "ts_parser.h" #include "vidc_color_converter.h" -#include "vidc_debug.h" extern "C" { OMX_API void * get_omx_component_factory_fn(void); } @@ -657,7 +660,7 @@ class omx_vdec: public qc_omx_component { if (m_cb.EventHandler && !m_error_propogated) { - DEBUG_PRINT_ERROR("\nERROR: Sending OMX_EventError to Client"); + ALOGE("\nERROR: Sending OMX_EventError to Client"); m_error_propogated = true; m_cb.EventHandler(&m_cmp,m_app_data, OMX_EventError,OMX_ErrorHardware,0,NULL); diff --git a/mm-video/vidc/vdec/inc/ts_parser.h b/mm-video/vidc/vdec/inc/ts_parser.h index c52f4b2..f0658b8 100644 --- a/mm-video/vidc/vdec/inc/ts_parser.h +++ b/mm-video/vidc/vdec/inc/ts_parser.h @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. +Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -31,7 +31,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OMX_Core.h" #include "OMX_QCOMExtns.h" #include "qc_omx_component.h" -#include "vidc_debug.h" #include @@ -77,7 +76,7 @@ class omx_time_stamp_reorder { void delete_list(); void handle_error() { - DEBUG_PRINT_ERROR("Error handler called for TS Parser"); + ALOGE("Error handler called for TS Parser"); if (error) return; error = true; diff --git a/mm-video/vidc/vdec/src/frameparser.cpp b/mm-video/vidc/vdec/src/frameparser.cpp index 24d2d13..404c2c3 100644 --- a/mm-video/vidc/vdec/src/frameparser.cpp +++ b/mm-video/vidc/vdec/src/frameparser.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2011,2013, The Linux Foundation. All rights reserved. +Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -43,8 +43,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "frameparser.h" -#include "vidc_debug.h" - #ifdef _ANDROID_ extern "C"{ @@ -52,6 +50,13 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } #endif//_ANDROID_ +#undef DEBUG_PRINT_LOW +#undef DEBUG_PRINT_HIGH +#undef DEBUG_PRINT_ERROR + +#define DEBUG_PRINT_LOW ALOGV +#define DEBUG_PRINT_HIGH ALOGV +#define DEBUG_PRINT_ERROR ALOGE static unsigned char H264_mask_code[4] = {0xFF,0xFF,0xFF,0xFF}; static unsigned char H264_start_code[4] = {0x00,0x00,0x00,0x01}; diff --git a/mm-video/vidc/vdec/src/h264_utils.cpp b/mm-video/vidc/vdec/src/h264_utils.cpp index c384c1b..b94f023 100644 --- a/mm-video/vidc/vdec/src/h264_utils.cpp +++ b/mm-video/vidc/vdec/src/h264_utils.cpp @@ -46,7 +46,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ========================================================================== */ #include "h264_utils.h" -#include "vidc_debug.h" #include "extra_data_handler.h" #include #include @@ -107,7 +106,7 @@ void RbspParser::advance () * I don't see a problem here */ //throw false; - DEBUG_PRINT_LOW("H264Parser-->NEED TO THROW THE EXCEPTION...\n"); + ALOGV("H264Parser-->NEED TO THROW THE EXCEPTION...\n"); } cursor <<= 8; //cursor |= static_cast (*pos); @@ -269,7 +268,7 @@ boolean H264_Utils::extract_rbsp(OMX_IN OMX_U8 *buffer, do { if(pos >= buffer_length) { - DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__); + ALOGE("ERROR: In %s() - line %d", __func__, __LINE__); return false; } @@ -290,28 +289,28 @@ boolean H264_Utils::extract_rbsp(OMX_IN OMX_U8 *buffer, } if (nal_len >= buffer_length) { - DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__); + ALOGE("ERROR: In %s() - line %d", __func__, __LINE__); return false; } } if (nal_len > buffer_length) { - DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__); + ALOGE("ERROR: In %s() - line %d", __func__, __LINE__); return false; } if(pos + 1 > (nal_len + sizeofNalLengthField)) { - DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__); + ALOGE("ERROR: In %s() - line %d", __func__, __LINE__); return false; } if (nal_unit->forbidden_zero_bit = (buffer[pos] & 0x80)) { - DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__); + ALOGE("ERROR: In %s() - line %d", __func__, __LINE__); } nal_unit->nal_ref_idc = (buffer[pos] & 0x60) >> 5; nal_unit->nalu_type = buffer[pos++] & 0x1f; - DEBUG_PRINT_LOW("\n@#@# Pos = %x NalType = %x buflen = %d", + ALOGV("\n@#@# Pos = %x NalType = %x buflen = %d", pos-1, nal_unit->nalu_type, buffer_length); *rbsp_length = 0; @@ -392,14 +391,14 @@ bool H264_Utils::isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr, OMX_IN OMX_U32 buffer_length = p_buf_hdr->nFilledLen; bool eRet = true; - DEBUG_PRINT_LOW("isNewFrame: buffer %p buffer_length %d " + ALOGV("isNewFrame: buffer %p buffer_length %d " "size_of_nal_length_field %d\n", buffer, buffer_length, size_of_nal_length_field); if ( false == extract_rbsp(buffer, buffer_length, size_of_nal_length_field, m_rbspBytes, &numBytesInRBSP, &nal_unit) ) { - DEBUG_PRINT_ERROR("ERROR: In %s() - extract_rbsp() failed", __func__); + ALOGE("ERROR: In %s() - extract_rbsp() failed", __func__); isNewFrame = OMX_FALSE; eRet = false; } @@ -411,7 +410,7 @@ bool H264_Utils::isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr, case NALU_TYPE_IDR: case NALU_TYPE_NON_IDR: { - DEBUG_PRINT_LOW("\n AU Boundary with NAL type %d ",nal_unit.nalu_type); + ALOGV("\n AU Boundary with NAL type %d ",nal_unit.nalu_type); if (m_forceToStichNextNAL) { isNewFrame = OMX_FALSE; @@ -442,7 +441,7 @@ bool H264_Utils::isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr, case NALU_TYPE_PPS: case NALU_TYPE_SEI: { - DEBUG_PRINT_LOW("\n Non-AU boundary with NAL type %d", nal_unit.nalu_type); + ALOGV("\n Non-AU boundary with NAL type %d", nal_unit.nalu_type); if(m_au_data) { isNewFrame = OMX_TRUE; @@ -469,7 +468,7 @@ bool H264_Utils::isNewFrame(OMX_BUFFERHEADERTYPE *p_buf_hdr, } // end of switch } // end of if m_prv_nalu = nal_unit; - DEBUG_PRINT_LOW("get_h264_nal_type - newFrame value %d\n",isNewFrame); + ALOGV("get_h264_nal_type - newFrame value %d\n",isNewFrame); return eRet; } @@ -495,10 +494,10 @@ void perf_metrics::stop() void perf_metrics::end(OMX_U32 units_cntr) { stop(); - DEBUG_PRINT_LOW("--> Processing time : [%.2f] Sec", (float)proc_time / 1e6); + ALOGV("--> Processing time : [%.2f] Sec", (float)proc_time / 1e6); if (units_cntr) { - DEBUG_PRINT_LOW("--> Avrg proc time : [%.2f] mSec", proc_time / (float)(units_cntr * 1e3)); + ALOGV("--> Avrg proc time : [%.2f] mSec", proc_time / (float)(units_cntr * 1e3)); } } @@ -528,11 +527,11 @@ h264_stream_parser::h264_stream_parser() panscan_hdl = new panscan_handler(); if (!panscan_hdl) { - DEBUG_PRINT_ERROR("ERROR: Panscan hdl was not allocated!"); + ALOGE("ERROR: Panscan hdl was not allocated!"); } else if (!panscan_hdl->initialize(10)) { - DEBUG_PRINT_ERROR("ERROR: Allocating memory for panscan!"); + ALOGE("ERROR: Allocating memory for panscan!"); delete panscan_hdl; panscan_hdl = NULL; } @@ -584,7 +583,7 @@ void h264_stream_parser::init_bitstream(OMX_U8* data, OMX_U32 size) void h264_stream_parser::parse_vui(bool vui_in_extradata) { OMX_U32 value = 0; - DEBUG_PRINT_LOW("parse_vui: IN"); + ALOGV("parse_vui: IN"); if (vui_in_extradata) while (!extract_bits(1) && more_bits()); // Discard VUI enable flag if (!more_bits()) @@ -593,7 +592,7 @@ void h264_stream_parser::parse_vui(bool vui_in_extradata) vui_param.aspect_ratio_info_present_flag = extract_bits(1); //aspect_ratio_info_present_flag if (vui_param.aspect_ratio_info_present_flag) { - DEBUG_PRINT_LOW("Aspect Ratio Info present!"); + ALOGV("Aspect Ratio Info present!"); aspect_ratio_info(); } @@ -621,28 +620,28 @@ void h264_stream_parser::parse_vui(bool vui_in_extradata) vui_param.num_units_in_tick = extract_bits(32); vui_param.time_scale = extract_bits(32); vui_param.fixed_frame_rate_flag = extract_bits(1); - DEBUG_PRINT_LOW("Timing info present in VUI!"); - DEBUG_PRINT_LOW(" num units in tick : %u", vui_param.num_units_in_tick); - DEBUG_PRINT_LOW(" time scale : %u", vui_param.time_scale); - DEBUG_PRINT_LOW(" fixed frame rate : %u", vui_param.fixed_frame_rate_flag); + ALOGV("Timing info present in VUI!"); + ALOGV(" num units in tick : %u", vui_param.num_units_in_tick); + ALOGV(" time scale : %u", vui_param.time_scale); + ALOGV(" fixed frame rate : %u", vui_param.fixed_frame_rate_flag); } vui_param.nal_hrd_parameters_present_flag = extract_bits(1); if (vui_param.nal_hrd_parameters_present_flag) { - DEBUG_PRINT_LOW("nal hrd params present!"); + ALOGV("nal hrd params present!"); hrd_parameters(&vui_param.nal_hrd_parameters); } vui_param.vcl_hrd_parameters_present_flag = extract_bits(1); if (vui_param.vcl_hrd_parameters_present_flag) { - DEBUG_PRINT_LOW("vcl hrd params present!"); + ALOGV("vcl hrd params present!"); hrd_parameters(&vui_param.vcl_hrd_parameters); } if (vui_param.nal_hrd_parameters_present_flag || vui_param.vcl_hrd_parameters_present_flag) vui_param.low_delay_hrd_flag = extract_bits(1); vui_param.pic_struct_present_flag = extract_bits(1); - DEBUG_PRINT_LOW("pic_struct_present_flag : %u", vui_param.pic_struct_present_flag); + ALOGV("pic_struct_present_flag : %u", vui_param.pic_struct_present_flag); if (extract_bits(1)) //bitstream_restriction_flag { extract_bits(1); //motion_vectors_over_pic_boundaries_flag @@ -653,12 +652,12 @@ void h264_stream_parser::parse_vui(bool vui_in_extradata) uev(); //num_reorder_frames uev(); //max_dec_frame_buffering } - DEBUG_PRINT_LOW("parse_vui: OUT"); + ALOGV("parse_vui: OUT"); } void h264_stream_parser::aspect_ratio_info() { - DEBUG_PRINT_LOW("aspect_ratio_info: IN"); + ALOGV("aspect_ratio_info: IN"); OMX_U32 aspect_ratio_idc = 0; OMX_U32 aspect_ratio_x = 0; OMX_U32 aspect_ratio_y = 0; @@ -734,31 +733,31 @@ void h264_stream_parser::aspect_ratio_info() aspect_ratio_y = extract_bits(16); //sar_height break; default: - DEBUG_PRINT_LOW("-->aspect_ratio_idc: Reserved Value "); + ALOGV("-->aspect_ratio_idc: Reserved Value "); break; } - DEBUG_PRINT_LOW("-->aspect_ratio_idc : %u", aspect_ratio_idc); - DEBUG_PRINT_LOW("-->aspect_ratio_x : %u", aspect_ratio_x); - DEBUG_PRINT_LOW("-->aspect_ratio_y : %u", aspect_ratio_y); + ALOGV("-->aspect_ratio_idc : %u", aspect_ratio_idc); + ALOGV("-->aspect_ratio_x : %u", aspect_ratio_x); + ALOGV("-->aspect_ratio_y : %u", aspect_ratio_y); vui_param.aspect_ratio_info.aspect_ratio_idc = aspect_ratio_idc; vui_param.aspect_ratio_info.aspect_ratio_x = aspect_ratio_x; vui_param.aspect_ratio_info.aspect_ratio_y = aspect_ratio_y; - DEBUG_PRINT_LOW("aspect_ratio_info: OUT"); + ALOGV("aspect_ratio_info: OUT"); } void h264_stream_parser::hrd_parameters(h264_hrd_param *hrd_param) { int idx; - DEBUG_PRINT_LOW("hrd_parameters: IN"); + ALOGV("hrd_parameters: IN"); hrd_param->cpb_cnt = uev() + 1; hrd_param->bit_rate_scale = extract_bits(4); hrd_param->cpb_size_scale = extract_bits(4); - DEBUG_PRINT_LOW("-->cpb_cnt : %u", hrd_param->cpb_cnt); - DEBUG_PRINT_LOW("-->bit_rate_scale : %u", hrd_param->bit_rate_scale); - DEBUG_PRINT_LOW("-->cpb_size_scale : %u", hrd_param->cpb_size_scale); + ALOGV("-->cpb_cnt : %u", hrd_param->cpb_cnt); + ALOGV("-->bit_rate_scale : %u", hrd_param->bit_rate_scale); + ALOGV("-->cpb_size_scale : %u", hrd_param->cpb_size_scale); if (hrd_param->cpb_cnt > MAX_CPB_COUNT) { - DEBUG_PRINT_LOW("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); + ALOGV("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); return; } for (idx = 0; idx < hrd_param->cpb_cnt && more_bits(); idx++) @@ -766,19 +765,19 @@ void h264_stream_parser::hrd_parameters(h264_hrd_param *hrd_param) hrd_param->bit_rate_value[idx] = uev() + 1; hrd_param->cpb_size_value[idx] = uev() + 1; hrd_param->cbr_flag[idx] = extract_bits(1); - DEBUG_PRINT_LOW("-->bit_rate_value [%d] : %u", idx, hrd_param->bit_rate_value[idx]); - DEBUG_PRINT_LOW("-->cpb_size_value [%d] : %u", idx, hrd_param->cpb_size_value[idx]); - DEBUG_PRINT_LOW("-->cbr_flag [%d] : %u", idx, hrd_param->cbr_flag[idx]); + ALOGV("-->bit_rate_value [%d] : %u", idx, hrd_param->bit_rate_value[idx]); + ALOGV("-->cpb_size_value [%d] : %u", idx, hrd_param->cpb_size_value[idx]); + ALOGV("-->cbr_flag [%d] : %u", idx, hrd_param->cbr_flag[idx]); } hrd_param->initial_cpb_removal_delay_length = extract_bits(5) + 1; hrd_param->cpb_removal_delay_length = extract_bits(5) + 1; hrd_param->dpb_output_delay_length = extract_bits(5) + 1; hrd_param->time_offset_length = extract_bits(5); - DEBUG_PRINT_LOW("-->initial_cpb_removal_delay_length : %u", hrd_param->initial_cpb_removal_delay_length); - DEBUG_PRINT_LOW("-->cpb_removal_delay_length : %u", hrd_param->cpb_removal_delay_length); - DEBUG_PRINT_LOW("-->dpb_output_delay_length : %u", hrd_param->dpb_output_delay_length); - DEBUG_PRINT_LOW("-->time_offset_length : %u", hrd_param->time_offset_length); - DEBUG_PRINT_LOW("hrd_parameters: OUT"); + ALOGV("-->initial_cpb_removal_delay_length : %u", hrd_param->initial_cpb_removal_delay_length); + ALOGV("-->cpb_removal_delay_length : %u", hrd_param->cpb_removal_delay_length); + ALOGV("-->dpb_output_delay_length : %u", hrd_param->dpb_output_delay_length); + ALOGV("-->time_offset_length : %u", hrd_param->time_offset_length); + ALOGV("hrd_parameters: OUT"); } void h264_stream_parser::parse_sei() @@ -786,24 +785,24 @@ void h264_stream_parser::parse_sei() OMX_U32 value = 0, processed_bytes = 0; OMX_U8 *sei_msg_start = bitstream; OMX_U32 sei_unit_size = bitstream_bytes; - DEBUG_PRINT_LOW("@@parse_sei: IN sei_unit_size(%u)", sei_unit_size); + ALOGV("@@parse_sei: IN sei_unit_size(%u)", sei_unit_size); while ((processed_bytes + 2) < sei_unit_size && more_bits()) { init_bitstream(sei_msg_start + processed_bytes, sei_unit_size - processed_bytes); - DEBUG_PRINT_LOW("-->NALU_TYPE_SEI"); + ALOGV("-->NALU_TYPE_SEI"); OMX_U32 payload_type = 0, payload_size = 0, aux = 0; do { value = extract_bits(8); payload_type += value; processed_bytes++; } while (value == 0xFF); - DEBUG_PRINT_LOW("-->payload_type : %u", payload_type); + ALOGV("-->payload_type : %u", payload_type); do { value = extract_bits(8); payload_size += value; processed_bytes++; } while (value == 0xFF); - DEBUG_PRINT_LOW("-->payload_size : %u", payload_size); + ALOGV("-->payload_size : %u", payload_size); if (payload_size > 0) { switch (payload_type) @@ -821,13 +820,13 @@ void h264_stream_parser::parse_sei() parse_frame_pack(); break; default: - DEBUG_PRINT_LOW("-->SEI payload type [%u] not implemented! size[%u]", payload_type, payload_size); + ALOGV("-->SEI payload type [%u] not implemented! size[%u]", payload_type, payload_size); } } processed_bytes += (payload_size + emulation_code_skip_cntr); - DEBUG_PRINT_LOW("-->SEI processed_bytes[%u]", processed_bytes); + ALOGV("-->SEI processed_bytes[%u]", processed_bytes); } - DEBUG_PRINT_LOW("@@parse_sei: OUT"); + ALOGV("@@parse_sei: OUT"); } void h264_stream_parser::sei_buffering_period() @@ -835,12 +834,12 @@ void h264_stream_parser::sei_buffering_period() int idx; OMX_U32 value = 0; h264_hrd_param *hrd_param = NULL; - DEBUG_PRINT_LOW("@@sei_buffering_period: IN"); + ALOGV("@@sei_buffering_period: IN"); value = uev(); // seq_parameter_set_id - DEBUG_PRINT_LOW("-->seq_parameter_set_id : %u", value); + ALOGV("-->seq_parameter_set_id : %u", value); if (value > 31) { - DEBUG_PRINT_LOW("ERROR: Invalid seq_parameter_set_id [%u]!", value); + ALOGV("ERROR: Invalid seq_parameter_set_id [%u]!", value); return; } sei_buf_period.is_valid = false; @@ -849,7 +848,7 @@ void h264_stream_parser::sei_buffering_period() hrd_param = &vui_param.nal_hrd_parameters; if (hrd_param->cpb_cnt > MAX_CPB_COUNT) { - DEBUG_PRINT_LOW("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); + ALOGV("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); return; } for (idx = 0; idx < hrd_param->cpb_cnt ; idx++) @@ -857,8 +856,8 @@ void h264_stream_parser::sei_buffering_period() sei_buf_period.is_valid = true; sei_buf_period.initial_cpb_removal_delay[idx] = extract_bits(hrd_param->initial_cpb_removal_delay_length); sei_buf_period.initial_cpb_removal_delay_offset[idx] = extract_bits(hrd_param->initial_cpb_removal_delay_length); - DEBUG_PRINT_LOW("-->initial_cpb_removal_delay : %u", sei_buf_period.initial_cpb_removal_delay[idx]); - DEBUG_PRINT_LOW("-->initial_cpb_removal_delay_offset : %u", sei_buf_period.initial_cpb_removal_delay_offset[idx]); + ALOGV("-->initial_cpb_removal_delay : %u", sei_buf_period.initial_cpb_removal_delay[idx]); + ALOGV("-->initial_cpb_removal_delay_offset : %u", sei_buf_period.initial_cpb_removal_delay_offset[idx]); } } if (vui_param.vcl_hrd_parameters_present_flag) @@ -866,7 +865,7 @@ void h264_stream_parser::sei_buffering_period() hrd_param = &vui_param.vcl_hrd_parameters; if (hrd_param->cpb_cnt > MAX_CPB_COUNT) { - DEBUG_PRINT_LOW("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); + ALOGV("ERROR: Invalid hrd_param->cpb_cnt [%u]!", hrd_param->cpb_cnt); return; } for (idx = 0; idx < hrd_param->cpb_cnt ; idx++) @@ -874,17 +873,17 @@ void h264_stream_parser::sei_buffering_period() sei_buf_period.is_valid = true; sei_buf_period.initial_cpb_removal_delay[idx] = extract_bits(hrd_param->initial_cpb_removal_delay_length); sei_buf_period.initial_cpb_removal_delay_offset[idx] = extract_bits(hrd_param->initial_cpb_removal_delay_length); - DEBUG_PRINT_LOW("-->initial_cpb_removal_delay : %u", sei_buf_period.initial_cpb_removal_delay[idx]); - DEBUG_PRINT_LOW("-->initial_cpb_removal_delay_offset : %u", sei_buf_period.initial_cpb_removal_delay_offset[idx]); + ALOGV("-->initial_cpb_removal_delay : %u", sei_buf_period.initial_cpb_removal_delay[idx]); + ALOGV("-->initial_cpb_removal_delay_offset : %u", sei_buf_period.initial_cpb_removal_delay_offset[idx]); } } sei_buf_period.au_cntr = 0; - DEBUG_PRINT_LOW("@@sei_buffering_period: OUT"); + ALOGV("@@sei_buffering_period: OUT"); } void h264_stream_parser::sei_picture_timing() { - DEBUG_PRINT_LOW("@@sei_picture_timing: IN"); + ALOGV("@@sei_picture_timing: IN"); OMX_U32 time_offset_len = 0, cpb_removal_len = 24, dpb_output_len = 24; OMX_U8 cbr_flag = 0; sei_pic_timing.is_valid = true; @@ -904,10 +903,10 @@ void h264_stream_parser::sei_picture_timing() } sei_pic_timing.cpb_removal_delay = extract_bits(cpb_removal_len); sei_pic_timing.dpb_output_delay = extract_bits(dpb_output_len); - DEBUG_PRINT_LOW("-->cpb_removal_len : %u", cpb_removal_len); - DEBUG_PRINT_LOW("-->dpb_output_len : %u", dpb_output_len); - DEBUG_PRINT_LOW("-->cpb_removal_delay : %u", sei_pic_timing.cpb_removal_delay); - DEBUG_PRINT_LOW("-->dpb_output_delay : %u", sei_pic_timing.dpb_output_delay); + ALOGV("-->cpb_removal_len : %u", cpb_removal_len); + ALOGV("-->dpb_output_len : %u", dpb_output_len); + ALOGV("-->cpb_removal_delay : %u", sei_pic_timing.cpb_removal_delay); + ALOGV("-->dpb_output_delay : %u", sei_pic_timing.dpb_output_delay); if (vui_param.pic_struct_present_flag) { sei_pic_timing.pic_struct = extract_bits(4); @@ -918,15 +917,15 @@ void h264_stream_parser::sei_picture_timing() case 3: case 4: case 7: sei_pic_timing.num_clock_ts = 2; break; case 5: case 6: case 8: sei_pic_timing.num_clock_ts = 3; break; default: - DEBUG_PRINT_ERROR("sei_picture_timing: pic_struct invalid!"); + ALOGE("sei_picture_timing: pic_struct invalid!"); } - DEBUG_PRINT_LOW("-->num_clock_ts : %u", sei_pic_timing.num_clock_ts); + ALOGV("-->num_clock_ts : %u", sei_pic_timing.num_clock_ts); for (int i = 0; i < sei_pic_timing.num_clock_ts && more_bits(); i++) { sei_pic_timing.clock_ts_flag = extract_bits(1); if(sei_pic_timing.clock_ts_flag) { - DEBUG_PRINT_LOW("-->clock_timestamp present!"); + ALOGV("-->clock_timestamp present!"); sei_pic_timing.ct_type = extract_bits(2); sei_pic_timing.nuit_field_based_flag = extract_bits(1); sei_pic_timing.counting_type = extract_bits(5); @@ -934,8 +933,8 @@ void h264_stream_parser::sei_picture_timing() sei_pic_timing.discontinuity_flag = extract_bits(1); sei_pic_timing.cnt_dropped_flag = extract_bits(1); sei_pic_timing.n_frames = extract_bits(8); - DEBUG_PRINT_LOW("-->f_timestamp_flg : %u", sei_pic_timing.full_timestamp_flag); - DEBUG_PRINT_LOW("-->n_frames : %u", sei_pic_timing.n_frames); + ALOGV("-->f_timestamp_flg : %u", sei_pic_timing.full_timestamp_flag); + ALOGV("-->n_frames : %u", sei_pic_timing.n_frames); sei_pic_timing.seconds_value = 0; sei_pic_timing.minutes_value = 0; sei_pic_timing.hours_value = 0; @@ -947,15 +946,15 @@ void h264_stream_parser::sei_picture_timing() } else if (extract_bits(1)) { - DEBUG_PRINT_LOW("-->seconds_flag enabled!"); + ALOGV("-->seconds_flag enabled!"); sei_pic_timing.seconds_value = extract_bits(6); if (extract_bits(1)) { - DEBUG_PRINT_LOW("-->minutes_flag enabled!"); + ALOGV("-->minutes_flag enabled!"); sei_pic_timing.minutes_value = extract_bits(6); if (extract_bits(1)) { - DEBUG_PRINT_LOW("-->hours_flag enabled!"); + ALOGV("-->hours_flag enabled!"); sei_pic_timing.hours_value = extract_bits(5); } } @@ -963,14 +962,14 @@ void h264_stream_parser::sei_picture_timing() sei_pic_timing.time_offset = 0; if (time_offset_len > 0) sei_pic_timing.time_offset = iv(time_offset_len); - DEBUG_PRINT_LOW("-->seconds_value : %u", sei_pic_timing.seconds_value); - DEBUG_PRINT_LOW("-->minutes_value : %u", sei_pic_timing.minutes_value); - DEBUG_PRINT_LOW("-->hours_value : %u", sei_pic_timing.hours_value); - DEBUG_PRINT_LOW("-->time_offset : %d", sei_pic_timing.time_offset); + ALOGV("-->seconds_value : %u", sei_pic_timing.seconds_value); + ALOGV("-->minutes_value : %u", sei_pic_timing.minutes_value); + ALOGV("-->hours_value : %u", sei_pic_timing.hours_value); + ALOGV("-->time_offset : %d", sei_pic_timing.time_offset); } } } - DEBUG_PRINT_LOW("@@sei_picture_timing: OUT"); + ALOGV("@@sei_picture_timing: OUT"); } void h264_stream_parser::sei_pan_scan() @@ -989,14 +988,14 @@ void h264_stream_parser::sei_pan_scan() if (!pan_scan_param) { - DEBUG_PRINT_ERROR("sei_pan_scan: ERROR: Invalid pointer!"); + ALOGE("sei_pan_scan: ERROR: Invalid pointer!"); return; } pan_scan_param->rect_id = uev(); if (pan_scan_param->rect_id > 0xFF) { - DEBUG_PRINT_ERROR("sei_pan_scan: ERROR: Invalid rect_id[%u]!", pan_scan_param->rect_id); + ALOGE("sei_pan_scan: ERROR: Invalid rect_id[%u]!", pan_scan_param->rect_id); pan_scan_param->rect_id = NO_PAN_SCAN_BIT; return; } @@ -1010,7 +1009,7 @@ void h264_stream_parser::sei_pan_scan() pan_scan_param->cnt = uev() + 1; if (pan_scan_param->cnt > MAX_PAN_SCAN_RECT) { - DEBUG_PRINT_ERROR("sei_pan_scan: ERROR: Invalid num of rect [%u]!", pan_scan_param->cnt); + ALOGE("sei_pan_scan: ERROR: Invalid num of rect [%u]!", pan_scan_param->cnt); pan_scan_param->rect_id = NO_PAN_SCAN_BIT; return; } @@ -1040,29 +1039,29 @@ void h264_stream_parser::sei_pan_scan() void h264_stream_parser::print_pan_data(h264_pan_scan *pan_scan_param) { - DEBUG_PRINT_LOW("@@print_pan_data: IN"); + ALOGE("@@print_pan_data: IN"); - DEBUG_PRINT_LOW("-->rect_id : %u", pan_scan_param->rect_id); - DEBUG_PRINT_LOW("-->rect_cancel_flag : %u", pan_scan_param->rect_cancel_flag); + ALOGE("-->rect_id : %u", pan_scan_param->rect_id); + ALOGE("-->rect_cancel_flag : %u", pan_scan_param->rect_cancel_flag); - DEBUG_PRINT_LOW("-->cnt : %u", pan_scan_param->cnt); + ALOGV("-->cnt : %u", pan_scan_param->cnt); for (int i = 0; i < pan_scan_param->cnt; i++) { - DEBUG_PRINT_LOW("-->rect_left_offset : %d", pan_scan_param->rect_left_offset[i]); - DEBUG_PRINT_LOW("-->rect_right_offset : %d", pan_scan_param->rect_right_offset[i]); - DEBUG_PRINT_LOW("-->rect_top_offset : %d", pan_scan_param->rect_top_offset[i]); - DEBUG_PRINT_LOW("-->rect_bottom_offset : %d", pan_scan_param->rect_bottom_offset[i]); + ALOGE("-->rect_left_offset : %d", pan_scan_param->rect_left_offset[i]); + ALOGE("-->rect_right_offset : %d", pan_scan_param->rect_right_offset[i]); + ALOGE("-->rect_top_offset : %d", pan_scan_param->rect_top_offset[i]); + ALOGE("-->rect_bottom_offset : %d", pan_scan_param->rect_bottom_offset[i]); } - DEBUG_PRINT_LOW("-->repetition_period : %u", pan_scan_param->rect_repetition_period); + ALOGE("-->repetition_period : %u", pan_scan_param->rect_repetition_period); - DEBUG_PRINT_LOW("@@print_pan_data: OUT"); + ALOGE("@@print_pan_data: OUT"); } void h264_stream_parser::parse_sps() { OMX_U32 value = 0, scaling_matrix_limit; - DEBUG_PRINT_LOW("@@parse_sps: IN"); + ALOGV("@@parse_sps: IN"); value = extract_bits(8); //profile_idc extract_bits(8); //constraint flags and reserved bits extract_bits(8); //level_idc @@ -1119,7 +1118,7 @@ void h264_stream_parser::parse_sps() } if (extract_bits(1)) //vui_parameters_present_flag parse_vui(false); - DEBUG_PRINT_LOW("@@parse_sps: OUT"); + ALOGV("@@parse_sps: OUT"); } void h264_stream_parser::scaling_list(OMX_U32 size_of_scaling_list) @@ -1141,7 +1140,7 @@ OMX_U32 h264_stream_parser::extract_bits(OMX_U32 n) OMX_U32 value = 0; if (n > 32) { - DEBUG_PRINT_ERROR("ERROR: extract_bits limit to 32 bits!"); + ALOGE("ERROR: extract_bits limit to 32 bits!"); return value; } value = curr_32_bit >> (32 - n); @@ -1152,7 +1151,7 @@ OMX_U32 h264_stream_parser::extract_bits(OMX_U32 n) value |= (curr_32_bit >> (32 - n)); if (bits_read < n) { - DEBUG_PRINT_LOW("ERROR: extract_bits underflow!"); + ALOGV("ERROR: extract_bits underflow!"); value >>= (n - bits_read); n = bits_read; } @@ -1171,7 +1170,7 @@ void h264_stream_parser::read_word() if (*bitstream == EMULATION_PREVENTION_THREE_BYTE && zero_cntr >= 2 && emulation_sc_enabled) { - DEBUG_PRINT_LOW("EMULATION_PREVENTION_THREE_BYTE: Skip 0x03 byte aligned!"); + ALOGV("EMULATION_PREVENTION_THREE_BYTE: Skip 0x03 byte aligned!"); emulation_code_skip_cntr++; } else @@ -1224,7 +1223,7 @@ OMX_U32 h264_stream_parser::get_nal_unit_type(OMX_U32 *nal_unit_type) { OMX_U32 value = 0, consumed_bytes = 3; *nal_unit_type = NALU_TYPE_UNSPECIFIED; - DEBUG_PRINT_LOW("-->get_nal_unit_type: IN"); + ALOGV("-->get_nal_unit_type: IN"); value = extract_bits(24); while (value != 0x00000001 && more_bits()) { @@ -1234,32 +1233,32 @@ OMX_U32 h264_stream_parser::get_nal_unit_type(OMX_U32 *nal_unit_type) } if (value != 0x00000001) { - DEBUG_PRINT_ERROR("ERROR in get_nal_unit_type: Start code not found!"); + ALOGE("ERROR in get_nal_unit_type: Start code not found!"); } else { if (extract_bits(1)) // forbidden_zero_bit { - DEBUG_PRINT_ERROR("WARNING: forbidden_zero_bit should be zero!"); + ALOGE("WARNING: forbidden_zero_bit should be zero!"); } value = extract_bits(2); - DEBUG_PRINT_LOW("-->nal_ref_idc : %x", value); + ALOGV("-->nal_ref_idc : %x", value); *nal_unit_type = extract_bits(5); - DEBUG_PRINT_LOW("-->nal_unit_type : %x", *nal_unit_type); + ALOGV("-->nal_unit_type : %x", *nal_unit_type); consumed_bytes++; if (consumed_bytes > 5) { - DEBUG_PRINT_ERROR("-->WARNING: Startcode was found after the first 4 bytes!"); + ALOGE("-->WARNING: Startcode was found after the first 4 bytes!"); } } - DEBUG_PRINT_LOW("-->get_nal_unit_type: OUT"); + ALOGV("-->get_nal_unit_type: OUT"); return consumed_bytes; } OMX_S64 h264_stream_parser::calculate_buf_period_ts(OMX_S64 timestamp) { OMX_S64 clock_ts = timestamp; - DEBUG_PRINT_LOW("calculate_ts(): IN"); + ALOGV("calculate_ts(): IN"); if (sei_buf_period.au_cntr == 0) clock_ts = sei_buf_period.reference_ts = timestamp; else if (sei_pic_timing.is_valid && VALID_TS(sei_buf_period.reference_ts)) @@ -1268,7 +1267,7 @@ OMX_S64 h264_stream_parser::calculate_buf_period_ts(OMX_S64 timestamp) 1e6 * vui_param.num_units_in_tick / vui_param.time_scale; } sei_buf_period.au_cntr++; - DEBUG_PRINT_LOW("calculate_ts(): OUT"); + ALOGV("calculate_ts(): OUT"); return clock_ts; } @@ -1291,7 +1290,7 @@ void h264_stream_parser::parse_frame_pack() property_get("vidc.dec.debug.panframedata", property_value, "0"); enable_framepack_log = atoi(property_value); #endif - DEBUG_PRINT_LOW("\n%s:%d parse_frame_pack", __func__, __LINE__); + ALOGV("\n%s:%d parse_frame_pack", __func__, __LINE__); frame_packing_arrangement.id = uev(); @@ -1329,34 +1328,34 @@ void h264_stream_parser::parse_frame_pack() void h264_stream_parser::print_frame_pack() { - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.id = %u", frame_packing_arrangement.id); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.cancel_flag = %u", + ALOGE("\n ## frame_packing_arrangement.id = %u", frame_packing_arrangement.id); + ALOGE("\n ## frame_packing_arrangement.cancel_flag = %u", frame_packing_arrangement.cancel_flag); if(!frame_packing_arrangement.cancel_flag) { - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.type = %u", + ALOGE("\n ## frame_packing_arrangement.type = %u", frame_packing_arrangement.type); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.quincunx_sampling_flag = %u", + ALOGE("\n ## frame_packing_arrangement.quincunx_sampling_flag = %u", frame_packing_arrangement.quincunx_sampling_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.content_interpretation_type = %u", + ALOGE("\n ## frame_packing_arrangement.content_interpretation_type = %u", frame_packing_arrangement.content_interpretation_type); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.spatial_flipping_flag = %u", + ALOGE("\n ## frame_packing_arrangement.spatial_flipping_flag = %u", frame_packing_arrangement.spatial_flipping_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.frame0_flipped_flag = %u", + ALOGE("\n ## frame_packing_arrangement.frame0_flipped_flag = %u", frame_packing_arrangement.frame0_flipped_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.field_views_flag = %u", + ALOGE("\n ## frame_packing_arrangement.field_views_flag = %u", frame_packing_arrangement.field_views_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.current_frame_is_frame0_flag = %u", + ALOGE("\n ## frame_packing_arrangement.current_frame_is_frame0_flag = %u", frame_packing_arrangement.current_frame_is_frame0_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.frame0_self_contained_flag = %u", + ALOGE("\n ## frame_packing_arrangement.frame0_self_contained_flag = %u", frame_packing_arrangement.frame0_self_contained_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.frame1_self_contained_flag = %u", + ALOGE("\n ## frame_packing_arrangement.frame1_self_contained_flag = %u", frame_packing_arrangement.frame1_self_contained_flag); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.reserved_byte = %u", + ALOGE("\n ## frame_packing_arrangement.reserved_byte = %u", frame_packing_arrangement.reserved_byte); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.repetition_period = %u", + ALOGE("\n ## frame_packing_arrangement.repetition_period = %u", frame_packing_arrangement.repetition_period); - DEBUG_PRINT_LOW("\n ## frame_packing_arrangement.extension_flag = %u", + ALOGE("\n ## frame_packing_arrangement.extension_flag = %u", frame_packing_arrangement.extension_flag); } } @@ -1365,7 +1364,7 @@ void h264_stream_parser::print_frame_pack() void h264_stream_parser::get_frame_pack_data( OMX_QCOM_FRAME_PACK_ARRANGEMENT *frame_pack) { - DEBUG_PRINT_LOW("\n%s:%d get frame data", __func__, __LINE__); + ALOGV("\n%s:%d get frame data", __func__, __LINE__); memcpy(&frame_pack->id,&frame_packing_arrangement.id, FRAME_PACK_SIZE*sizeof(OMX_U32)); return; @@ -1374,7 +1373,7 @@ void h264_stream_parser::get_frame_pack_data( bool h264_stream_parser::is_mbaff() { - DEBUG_PRINT_LOW("\n%s:%d MBAFF flag=%d", __func__, __LINE__,mbaff_flag); + ALOGV("\n%s:%d MBAFF flag=%d", __func__, __LINE__,mbaff_flag); return mbaff_flag; } @@ -1387,7 +1386,7 @@ void h264_stream_parser::get_frame_rate(OMX_U32 *frame_rate) void h264_stream_parser::parse_nal(OMX_U8* data_ptr, OMX_U32 data_len, OMX_U32 nal_type, bool enable_emu_sc) { OMX_U32 nal_unit_type = NALU_TYPE_UNSPECIFIED, cons_bytes = 0; - DEBUG_PRINT_LOW("parse_nal(): IN nal_type(%lu)", nal_type); + ALOGV("parse_nal(): IN nal_type(%lu)", nal_type); if (!data_len) return; init_bitstream(data_ptr, data_len); @@ -1397,7 +1396,7 @@ void h264_stream_parser::parse_nal(OMX_U8* data_ptr, OMX_U32 data_len, OMX_U32 n cons_bytes = get_nal_unit_type(&nal_unit_type); if (nal_type != nal_unit_type && nal_type != NALU_TYPE_UNSPECIFIED) { - DEBUG_PRINT_LOW("Unexpected nal_type(%x) expected(%x)", nal_unit_type, nal_type); + ALOGV("Unexpected nal_type(%x) expected(%x)", nal_unit_type, nal_type); return; } } @@ -1418,9 +1417,9 @@ void h264_stream_parser::parse_nal(OMX_U8* data_ptr, OMX_U32 data_len, OMX_U32 n parse_vui(true); break; default: - DEBUG_PRINT_LOW("nal_unit_type received : %lu", nal_type); + ALOGV("nal_unit_type received : %lu", nal_type); } - DEBUG_PRINT_LOW("parse_nal(): OUT"); + ALOGV("parse_nal(): OUT"); } #ifdef PANSCAN_HDLR @@ -1485,7 +1484,7 @@ OMX_S64 h264_stream_parser::process_ts_with_sei_vui(OMX_S64 timestamp) clock_ts = ((sei_pic_timing.hours_value * 60 + sei_pic_timing.minutes_value) * 60 + sei_pic_timing.seconds_value) * 1e6 + (sei_pic_timing.n_frames * (vui_param.num_units_in_tick * (1 + sei_pic_timing.nuit_field_based_flag)) + sei_pic_timing.time_offset) * 1e6 / vui_param.time_scale; - DEBUG_PRINT_LOW("-->CLOCK TIMESTAMP : %lld", clock_ts); + ALOGV("-->CLOCK TIMESTAMP : %lld", clock_ts); clock_ts_flag = true; } if (vui_param.fixed_frame_rate_flag) @@ -1498,7 +1497,7 @@ OMX_S64 h264_stream_parser::process_ts_with_sei_vui(OMX_S64 timestamp) case 7: deltaTfiDivisor = 4; break; case 8: deltaTfiDivisor = 6; break; default: - DEBUG_PRINT_ERROR("process_ts_with_sei_vui: pic_struct invalid!"); + ALOGE("process_ts_with_sei_vui: pic_struct invalid!"); } } } @@ -1512,7 +1511,7 @@ OMX_S64 h264_stream_parser::process_ts_with_sei_vui(OMX_S64 timestamp) } else { - DEBUG_PRINT_LOW("NO TIMING information present in VUI!"); + ALOGV("NO TIMING information present in VUI!"); } sei_pic_timing.is_valid = false; // SEI data is valid only for current frame return clock_ts; @@ -1545,7 +1544,7 @@ bool panscan_handler::initialize(int num_data) } else { - DEBUG_PRINT_ERROR("ERROR: Old panscan memory must be freed to allocate new"); + ALOGE("ERROR: Old panscan memory must be freed to allocate new"); } return ret; } diff --git a/mm-video/vidc/vdec/src/mp4_utils.cpp b/mm-video/vidc/vdec/src/mp4_utils.cpp index d268eab..38935cc 100644 --- a/mm-video/vidc/vdec/src/mp4_utils.cpp +++ b/mm-video/vidc/vdec/src/mp4_utils.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. +Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -27,7 +27,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------*/ #include "mp4_utils.h" #include "omx_vdec.h" -#include "vidc_debug.h" # include #ifdef _ANDROID_ extern "C"{ @@ -35,6 +34,14 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } #endif//_ANDROID_ +#undef DEBUG_PRINT_LOW +#undef DEBUG_PRINT_HIGH +#undef DEBUG_PRINT_ERROR + +#define DEBUG_PRINT_LOW ALOGV +#define DEBUG_PRINT_HIGH ALOGV +#define DEBUG_PRINT_ERROR ALOGE + MP4_Utils::MP4_Utils() { m_SrcWidth = 0; diff --git a/mm-video/vidc/vdec/src/omx_vdec.cpp b/mm-video/vidc/vdec/src/omx_vdec.cpp index e45e554..5aeea2c 100644 --- a/mm-video/vidc/vdec/src/omx_vdec.cpp +++ b/mm-video/vidc/vdec/src/omx_vdec.cpp @@ -163,8 +163,6 @@ pthread_mutex_t omx_vdec::m_vdec_ionlock; const uint32_t START_BROADCAST_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION + 13; #endif -int debug_level = PRIO_ERROR; - void* async_message_thread (void *input) { struct vdec_ioctl_msg ioctl_msg; @@ -243,7 +241,7 @@ bool sendBroadCastEvent(String16 intentName) { sp sm = defaultServiceManager(); sp am = sm->getService(String16("activity")); if (am == NULL) { - DEBUG_PRINT_ERROR("startServiceThroughActivityManager() couldn't find activity service!\n"); + ALOGE("startServiceThroughActivityManager() couldn't find activity service!\n"); return false; } @@ -251,7 +249,7 @@ bool sendBroadCastEvent(String16 intentName) { data.writeInterfaceToken(String16("android.app.IActivityManager")); data.writeStrongBinder(NULL); // The application thread - DEBUG_PRINT_LOW("Sending NULL Binder "); + ALOGV("Sending NULL Binder "); // Intent Start data.writeString16(intentName); // mAction (null) @@ -593,12 +591,6 @@ omx_vdec::omx_vdec(): m_state(OMX_StateInvalid), m_debug_concealedmb = atoi(property_value); DEBUG_PRINT_HIGH("vidc.dec.debug.concealedmb value is %d",m_debug_concealedmb); - property_value[0] = NULL; - property_get("vidc.debug.level", property_value, "0"); - debug_level = atoi(property_value); - DEBUG_PRINT_HIGH("vidc.debug.level value is %d",debug_level); - property_value[0] = NULL; - #endif memset(&m_cmp,0,sizeof(m_cmp)); memset(&m_cb,0,sizeof(m_cb)); @@ -1479,7 +1471,7 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) OMX_MAX_STRINGNAME_SIZE)) { strlcpy((char *)m_cRole, "video_decoder.divx",OMX_MAX_STRINGNAME_SIZE); - DEBUG_PRINT_HIGH ("DIVX 4 Decoder selected"); + DEBUG_PRINT_ERROR ("DIVX 4 Decoder selected"); drv_ctx.decoder_format = VDEC_CODECTYPE_DIVX_4; eCompressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; codec_type_parse = CODEC_TYPE_DIVX; @@ -1497,7 +1489,7 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) OMX_MAX_STRINGNAME_SIZE)) { strlcpy((char *)m_cRole, "video_decoder.divx",OMX_MAX_STRINGNAME_SIZE); - DEBUG_PRINT_HIGH ("DIVX 5/6 Decoder selected"); + DEBUG_PRINT_ERROR ("DIVX 5/6 Decoder selected"); drv_ctx.decoder_format = VDEC_CODECTYPE_DIVX_6; eCompressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; codec_type_parse = CODEC_TYPE_DIVX; @@ -1517,7 +1509,7 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) "OMX.qcom.video.decoder.divx", OMX_MAX_STRINGNAME_SIZE))) { strlcpy((char *)m_cRole, "video_decoder.divx",OMX_MAX_STRINGNAME_SIZE); - DEBUG_PRINT_HIGH("DIVX Decoder selected"); + DEBUG_PRINT_ERROR ("DIVX Decoder selected"); drv_ctx.decoder_format = VDEC_CODECTYPE_DIVX_5; eCompressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; codec_type_parse = CODEC_TYPE_DIVX; @@ -9857,7 +9849,7 @@ OMX_ERRORTYPE omx_vdec::vdec_alloc_h264_mv() return OMX_ErrorInsufficientResources; } - DEBUG_PRINT_HIGH("GET_MV_BUFFER_SIZE returned: Size: %d and alignment: %d", + DEBUG_PRINT_ERROR("GET_MV_BUFFER_SIZE returned: Size: %d and alignment: %d", mv_buff_size.size, mv_buff_size.alignment); size = mv_buff_size.size * drv_ctx.op_buf.actualcount; @@ -10024,7 +10016,7 @@ bool omx_vdec::allocate_color_convert_buf::update_buffer_req() return false; } if (!enabled){ - DEBUG_PRINT_HIGH("\n No color conversion required"); + DEBUG_PRINT_ERROR("\n No color conversion required"); return status; } if (omx->drv_ctx.output_format != VDEC_YUV_FORMAT_TILE_4x2 && diff --git a/mm-video/vidc/vdec/src/ts_parser.cpp b/mm-video/vidc/vdec/src/ts_parser.cpp index 23f7d34..b8a40b0 100644 --- a/mm-video/vidc/vdec/src/ts_parser.cpp +++ b/mm-video/vidc/vdec/src/ts_parser.cpp @@ -27,7 +27,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------*/ #include "ts_parser.h" -#define DEBUG DEBUG_PRINT_ERROR +#define DEBUG ALOGE void omx_time_stamp_reorder::set_timestamp_reorder_mode(bool mode) { reorder_ts = mode; diff --git a/mm-video/vidc/venc/inc/omx_video_base.h b/mm-video/vidc/venc/inc/omx_video_base.h index 22eb811..921c0fb 100644 --- a/mm-video/vidc/venc/inc/omx_video_base.h +++ b/mm-video/vidc/venc/inc/omx_video_base.h @@ -61,7 +61,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "C2DColorConverter.h" -#include "vidc_debug.h" #ifdef _ANDROID_ using namespace android; @@ -76,6 +75,10 @@ class VideoHeap : public MemoryHeapBase #include #define LOG_TAG "OMX-VENC-720p" +#else //_ANDROID_ +#define DEBUG_PRINT_LOW +#define DEBUG_PRINT_HIGH +#define DEBUG_PRINT_ERROR #endif // _ANDROID_ #ifdef USE_ION diff --git a/mm-video/vidc/venc/src/omx_video_encoder.cpp b/mm-video/vidc/venc/src/omx_video_encoder.cpp index 1bd9725..a9741ae 100644 --- a/mm-video/vidc/venc/src/omx_video_encoder.cpp +++ b/mm-video/vidc/venc/src/omx_video_encoder.cpp @@ -50,7 +50,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (_s_)->nVersion.nVersion = OMX_SPEC_VERSION extern int m_pipe; -int debug_level = PRIO_ERROR; // factory function executed by the core to create instances void *get_omx_component_factory_fn(void) @@ -69,10 +68,6 @@ omx_venc::omx_venc() memset(opaque_buffer_hdr,0,sizeof(opaque_buffer_hdr)); mUseProxyColorFormat = false; #endif - char property_value[PROPERTY_VALUE_MAX] = {0}; - property_get("vidc.debug.level", property_value, "0"); - debug_level = atoi(property_value); - property_value[0] = '\0'; } omx_venc::~omx_venc() From d8a3c0a5c52964aba79780a925d8bbcf723e37a0 Mon Sep 17 00:00:00 2001 From: Deepak Verma Date: Mon, 21 Oct 2013 15:49:31 +0530 Subject: [PATCH 3/5] mm-video: venc: Correct a typo in variable name A kernel variable was to be defined as unsigned long but it is mistakenly defined as unsigned only, the space is missing after long. This bug is silent because unsigned is also a valid data type by itself. Corresponding to kernel fix, similar correction is done in userspace code. Change-Id: Ie58f275149dc9c85553f75e02594113b1a03ddcf CRs-fixed: 556771 --- mm-video/vidc/venc/src/video_encoder_device.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm-video/vidc/venc/src/video_encoder_device.cpp b/mm-video/vidc/venc/src/video_encoder_device.cpp index a66f262..96faccc 100644 --- a/mm-video/vidc/venc/src/video_encoder_device.cpp +++ b/mm-video/vidc/venc/src/video_encoder_device.cpp @@ -1613,7 +1613,7 @@ void venc_dev::venc_config_print() multislice.mslice_size); DEBUG_PRINT_HIGH("\nENC_CONFIG: EntropyMode: %d, CabacModel: %d", - entropy.longentropysel, entropy.cabacmodel); + entropy.entropysel, entropy.cabacmodel); DEBUG_PRINT_HIGH("\nENC_CONFIG: DB-Mode: %d, alpha: %d, Beta: %d\n", dbkfilter.db_mode, dbkfilter.slicealpha_offset, @@ -2447,7 +2447,7 @@ bool venc_dev::venc_set_entropy_config(OMX_BOOL enable, OMX_U32 i_cabac_level) DEBUG_PRINT_LOW("\n venc_set_entropy_config: CABAC = %u level: %u", enable, i_cabac_level); if(enable &&(codec_profile.profile != VEN_PROFILE_H264_BASELINE)){ - entropy_cfg.longentropysel = VEN_ENTROPY_MODEL_CABAC; + entropy_cfg.entropysel = VEN_ENTROPY_MODEL_CABAC; if (i_cabac_level == 0) { entropy_cfg.cabacmodel = VEN_CABAC_MODEL_0; } @@ -2467,7 +2467,7 @@ bool venc_dev::venc_set_entropy_config(OMX_BOOL enable, OMX_U32 i_cabac_level) #endif } else if(!enable){ - entropy_cfg.longentropysel = VEN_ENTROPY_MODEL_CAVLC; + entropy_cfg.entropysel = VEN_ENTROPY_MODEL_CAVLC; } else{ DEBUG_PRINT_ERROR("\nInvalid Entropy mode for Baseline Profile"); @@ -2481,7 +2481,7 @@ bool venc_dev::venc_set_entropy_config(OMX_BOOL enable, OMX_U32 i_cabac_level) DEBUG_PRINT_ERROR("\nERROR: Request for setting entropy config failed"); return false; } - entropy.longentropysel = entropy_cfg.longentropysel; + entropy.entropysel = entropy_cfg.entropysel; entropy.cabacmodel = entropy_cfg.cabacmodel; return true; } From e94b8ceea64a01bb2f41a900deffcb8269782e62 Mon Sep 17 00:00:00 2001 From: Deepak Verma Date: Wed, 25 Sep 2013 15:32:32 +0530 Subject: [PATCH 4/5] mm-video: vdec: Support adaptive playback mode In this mode client checks and sets an extension to indicate that the content can change resolution, within the pre- announced maximum height/width. Component over-allocates buffers for the max resolution and dbp, and notifies client of any crop change when resolution changes within bounds. Resolution changes beyond set max width/height will result in port-reconfiguration notification, while adapting to the new resolution. Change-Id: I744ac475f3bbedaaca2b057e9a327243674f0d9e Conflicts: mm-video/vidc/vdec/src/omx_vdec.cpp --- mm-core/inc/OMX_QCOMExtns.h | 14 ++- mm-video/vidc/vdec/inc/omx_vdec.h | 3 + mm-video/vidc/vdec/src/omx_vdec.cpp | 155 ++++++++++++++++++++++++++-- 3 files changed, 161 insertions(+), 11 deletions(-) diff --git a/mm-core/inc/OMX_QCOMExtns.h b/mm-core/inc/OMX_QCOMExtns.h index 286a6aa..43ffe11 100644 --- a/mm-core/inc/OMX_QCOMExtns.h +++ b/mm-core/inc/OMX_QCOMExtns.h @@ -413,7 +413,9 @@ enum OMX_QCOM_EXTN_INDEXTYPE QOMX_IndexConfigVideoLTRUse = 0x7F00002B, /*"OMX.QCOM.index.config.video.LTRMark"*/ - QOMX_IndexConfigVideoLTRMark = 0x7F00002C + QOMX_IndexConfigVideoLTRMark = 0x7F00002C, + + OMX_GoogleAndroidIndexPrepareForAdaptivePlayback = 0x7F00002D, }; /** @@ -713,6 +715,16 @@ typedef struct OMX_QCOM_VIDEO_CONFIG_QPRANGE OMX_U32 nMaxQP; /** The number for maximum quantization parameter */ } OMX_QCOM_VIDEO_CONFIG_QPRANGE; +typedef struct PrepareForAdaptivePlaybackParams +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_U32 nMaxFrameWidth; + OMX_U32 nMaxFrameHeight; +} PrepareForAdaptivePlaybackParams; + typedef struct OMX_VENDOR_EXTRADATATYPE { OMX_U32 nPortIndex; diff --git a/mm-video/vidc/vdec/inc/omx_vdec.h b/mm-video/vidc/vdec/inc/omx_vdec.h index 5cbddcb..4beeaf3 100644 --- a/mm-video/vidc/vdec/inc/omx_vdec.h +++ b/mm-video/vidc/vdec/inc/omx_vdec.h @@ -789,6 +789,9 @@ class omx_vdec: public qc_omx_component OMX_U32 m_demux_entries; OMX_U32 m_disp_hor_size; OMX_U32 m_disp_vert_size; + OMX_U32 m_smoothstreaming_height; + OMX_U32 m_smoothstreaming_width; + bool m_use_smoothstreaming; OMX_S64 prev_ts; bool rst_prev_ts; diff --git a/mm-video/vidc/vdec/src/omx_vdec.cpp b/mm-video/vidc/vdec/src/omx_vdec.cpp index 5aeea2c..9b38c73 100644 --- a/mm-video/vidc/vdec/src/omx_vdec.cpp +++ b/mm-video/vidc/vdec/src/omx_vdec.cpp @@ -163,6 +163,14 @@ pthread_mutex_t omx_vdec::m_vdec_ionlock; const uint32_t START_BROADCAST_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION + 13; #endif +#ifdef MAX_RES_1080P +static const OMX_U32 kMaxSmoothStreamingWidth = 1920; +static const OMX_U32 kMaxSmoothStreamingHeight = 1088; +#else +static const OMX_U32 kMaxSmoothStreamingWidth = 1280; +static const OMX_U32 kMaxSmoothStreamingHeight = 720; +#endif + void* async_message_thread (void *input) { struct vdec_ioctl_msg ioctl_msg; @@ -541,6 +549,9 @@ omx_vdec::omx_vdec(): m_state(OMX_StateInvalid), m_inp_err_count(0), m_disp_hor_size(0), m_disp_vert_size(0), + m_smoothstreaming_height(0), + m_smoothstreaming_width(0), + m_use_smoothstreaming(false), #ifdef _ANDROID_ m_heap_ptr(NULL), m_heap_count(0), @@ -1615,12 +1626,10 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) eRet = OMX_ErrorInsufficientResources; } -#ifdef MAX_RES_720P - update_resolution(1280, 720); -#endif -#ifdef MAX_RES_1080P - update_resolution(1920, 1088); -#endif + if (m_use_smoothstreaming) + update_resolution(kMaxSmoothStreamingWidth, kMaxSmoothStreamingHeight); + else + update_resolution(176, 144); ioctl_msg.in = &drv_ctx.video_resolution; ioctl_msg.out = NULL; @@ -3311,8 +3320,38 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp, if (portDefn->format.video.nFrameHeight != 0x0 && portDefn->format.video.nFrameWidth != 0x0) { - update_resolution(portDefn->format.video.nFrameWidth, - portDefn->format.video.nFrameHeight); + if (m_use_smoothstreaming) + { + if (portDefn->format.video.nFrameWidth * portDefn->format.video.nFrameHeight <= + m_smoothstreaming_width * m_smoothstreaming_height) + { + DEBUG_PRINT_HIGH("Updating Input frame size(%d x %d) with" + " smoothstreaming frame size(%u x %u)", + portDefn->format.video.nFrameWidth, portDefn->format.video.nFrameHeight, + m_smoothstreaming_width, m_smoothstreaming_height); + update_resolution(m_smoothstreaming_width, m_smoothstreaming_height); + } + else if (portDefn->format.video.nFrameWidth * portDefn->format.video.nFrameHeight <= + kMaxSmoothStreamingWidth * kMaxSmoothStreamingHeight) + { + DEBUG_PRINT_HIGH("Updating Input frame size to (%d x %d)", + portDefn->format.video.nFrameWidth, portDefn->format.video.nFrameHeight); + m_smoothstreaming_height = portDefn->format.video.nFrameHeight; + m_smoothstreaming_width = portDefn->format.video.nFrameWidth; + update_resolution(m_smoothstreaming_width, m_smoothstreaming_height); + } + else + { + DEBUG_PRINT_ERROR("Input frame size(%d x %d) is more than max supported", + portDefn->format.video.nFrameWidth, portDefn->format.video.nFrameHeight); + return OMX_ErrorUnsupportedSetting; + } + } + else + { + update_resolution(portDefn->format.video.nFrameWidth, + portDefn->format.video.nFrameHeight); + } ioctl_msg.in = &drv_ctx.video_resolution; ioctl_msg.out = NULL; if (ioctl (drv_ctx.video_driver_fd, VDEC_IOCTL_SET_PICRES, @@ -3791,6 +3830,12 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp, DEBUG_PRINT_ERROR("Failed to enable Smooth Streaming on driver."); eRet = OMX_ErrorHardware; } + else + { + m_use_smoothstreaming = true; + m_smoothstreaming_width = kMaxSmoothStreamingWidth; + m_smoothstreaming_height = kMaxSmoothStreamingHeight; + } } } } @@ -3805,10 +3850,17 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp, DEBUG_PRINT_ERROR("Failed to enable Smooth Streaming on driver."); eRet = OMX_ErrorHardware; } + else + { + m_use_smoothstreaming = true; + } + drv_ctx.video_resolution.frame_width = - drv_ctx.video_resolution.stride = 1920; + drv_ctx.video_resolution.stride = + m_smoothstreaming_width = kMaxSmoothStreamingWidth; drv_ctx.video_resolution.frame_height = - drv_ctx.video_resolution.scan_lines = 1088; + drv_ctx.video_resolution.scan_lines = + m_smoothstreaming_height = kMaxSmoothStreamingHeight; ioctl_msg.in = &drv_ctx.video_resolution; ioctl_msg.out = NULL; if (ioctl (drv_ctx.video_driver_fd, VDEC_IOCTL_SET_PICRES, @@ -3887,6 +3939,64 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp, } } break; +#ifdef _ANDROID_ + case OMX_GoogleAndroidIndexPrepareForAdaptivePlayback: + { + DEBUG_PRINT_HIGH("set_parameter: " + "OMX_GoogleAndroidIndexPrepareForAdaptivePlayback"); + PrepareForAdaptivePlaybackParams* adaptivePlaybackParams = + (PrepareForAdaptivePlaybackParams *) paramData; + if (adaptivePlaybackParams->nPortIndex == OMX_CORE_OUTPUT_PORT_INDEX) { + if (!adaptivePlaybackParams->bEnable) { + DEBUG_PRINT_HIGH("Adaptive playback mode is disabled"); + return OMX_ErrorNone; + } + if ((adaptivePlaybackParams->nMaxFrameWidth * adaptivePlaybackParams->nMaxFrameHeight) > + (kMaxSmoothStreamingWidth * kMaxSmoothStreamingHeight)) { + DEBUG_PRINT_ERROR("Adaptive playback request exceeds max supported " + "resolution : [%d x %d] vs [%d x %d]", + adaptivePlaybackParams->nMaxFrameWidth, + adaptivePlaybackParams->nMaxFrameHeight, + kMaxSmoothStreamingWidth, kMaxSmoothStreamingHeight); + eRet = OMX_ErrorBadParameter; + } else { + int rc = ioctl(drv_ctx.video_driver_fd, + VDEC_IOCTL_SET_CONT_ON_RECONFIG); + if (rc < 0) { + DEBUG_PRINT_ERROR("Failed to enable Smooth Streaming on driver."); + eRet = OMX_ErrorInsufficientResources; + } else { + update_resolution(adaptivePlaybackParams->nMaxFrameWidth, + adaptivePlaybackParams->nMaxFrameHeight); + ioctl_msg.in = &drv_ctx.video_resolution; + ioctl_msg.out = NULL; + if (ioctl (drv_ctx.video_driver_fd,VDEC_IOCTL_SET_PICRES, + (void*)&ioctl_msg) < 0) { + DEBUG_PRINT_ERROR("Set Resolution failed"); + eRet = OMX_ErrorInsufficientResources; + } else { + eRet = get_buffer_req(&drv_ctx.op_buf); + if (eRet != OMX_ErrorNone) { + DEBUG_PRINT_ERROR("get_buffer_req(op_buf) failed!!"); + } else { + DEBUG_PRINT_HIGH("Enabling Adaptive playback for %d x %d", + adaptivePlaybackParams->nMaxFrameWidth, + adaptivePlaybackParams->nMaxFrameHeight); + m_use_smoothstreaming = true; + m_smoothstreaming_width = adaptivePlaybackParams->nMaxFrameWidth; + m_smoothstreaming_height = adaptivePlaybackParams->nMaxFrameHeight; + } + } + } + } + } else { + DEBUG_PRINT_ERROR("Prepare for adaptive playback supported only " + "on output port"); + eRet = OMX_ErrorBadParameter; + } + } + break; +#endif default: { DEBUG_PRINT_ERROR("Setparameter: unknown param %d\n", paramIndex); @@ -4260,6 +4370,9 @@ OMX_ERRORTYPE omx_vdec::get_extension_index(OMX_IN OMX_HANDLETYPE hComp, else if(!strncmp(paramName,"OMX.google.android.index.getAndroidNativeBufferUsage", sizeof("OMX.google.android.index.getAndroidNativeBufferUsage") - 1)) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage; } + else if(!strncmp(paramName,"OMX.google.android.index.prepareForAdaptivePlayback", sizeof("OMX.google.android.index.prepareForAdaptivePlayback") - 1)) { + *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexPrepareForAdaptivePlayback; + } #endif else { DEBUG_PRINT_ERROR("Extension: %s not implemented\n", paramName); @@ -8273,6 +8386,28 @@ OMX_ERRORTYPE omx_vdec::start_port_reconfig() in_reconfig = true; op_buf_rcnfg.buffer_type = VDEC_BUFFER_TYPE_OUTPUT; eRet = get_buffer_req(&op_buf_rcnfg); + if (m_use_smoothstreaming) + { + if (drv_ctx.video_resolution.frame_width * drv_ctx.video_resolution.frame_height > + kMaxSmoothStreamingWidth * kMaxSmoothStreamingHeight) { + DEBUG_PRINT_ERROR("Smoothstream playback request exceeds max supported " + "resolution : [%d x %d] vs [%d x %d]", + drv_ctx.video_resolution.frame_width, + drv_ctx.video_resolution.frame_height, + kMaxSmoothStreamingWidth, kMaxSmoothStreamingHeight); + eRet = OMX_ErrorBadParameter; + } + else if (m_smoothstreaming_width * m_smoothstreaming_height < + drv_ctx.video_resolution.frame_width * drv_ctx.video_resolution.frame_height) + { + DEBUG_PRINT_HIGH("Adaptive Smooth streaming parameters changed" + " from [%u x %u] to [%u x %u]", + m_smoothstreaming_width, m_smoothstreaming_height, + drv_ctx.video_resolution.frame_width, drv_ctx.video_resolution.frame_height); + m_smoothstreaming_width = drv_ctx.video_resolution.frame_width; + m_smoothstreaming_height = drv_ctx.video_resolution.frame_height; + } + } } } return eRet; From ba698bb206c9b57e8f78e87dd57266bdb26d9bc5 Mon Sep 17 00:00:00 2001 From: Surajit Podder Date: Wed, 30 Oct 2013 14:36:16 +0530 Subject: [PATCH 5/5] dashplayer: Handle error for text track Handle UNKNOWN_ERROR for text track Change-Id: Ifeb827b4b7f0fb796593789b0b51be333292c66f --- dashplayer/DashPlayer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dashplayer/DashPlayer.cpp b/dashplayer/DashPlayer.cpp index 6cf0639..2508083 100644 --- a/dashplayer/DashPlayer.cpp +++ b/dashplayer/DashPlayer.cpp @@ -1311,10 +1311,11 @@ status_t DashPlayer::feedDecoderInputData(int track, const sp &msg) { reply->post(); return OK; } - else if ( (track == kText) && (err == ERROR_END_OF_STREAM)) - { - sendTextPacket(NULL,ERROR_END_OF_STREAM); - return ERROR_END_OF_STREAM; + else if ((track == kText) && + (err == ERROR_END_OF_STREAM || err == (status_t)UNKNOWN_ERROR)) { + ALOGE("Text track has encountered error %d", err ); + sendTextPacket(NULL, err); + return err; } } @@ -1604,7 +1605,8 @@ void DashPlayer::sendTextPacket(sp accessUnit,status_t err) //Local setting parcel.writeInt32(KEY_LOCAL_SETTING); - if (err == ERROR_END_OF_STREAM) + if (err == ERROR_END_OF_STREAM || + err == (status_t)UNKNOWN_ERROR) { parcel.writeInt32(KEY_TEXT_EOS); // write size of sample