diff options
author | PacketVideo CM <engbuild@pv.com> | 2010-01-15 14:17:21 -0800 |
---|---|---|
committer | PacketVideo CM <engbuild@pv.com> | 2010-01-15 14:17:21 -0800 |
commit | ba4e61881c2792aa9c93a5e1a7f3d9a639e8b661 (patch) | |
tree | 9e6b9a8c19900f54153924610d857a5ce53541ad /protocols | |
parent | fafa01b9152771d5a9efe3e2380dad33d264613e (diff) | |
download | opencore-ba4e61881c2792aa9c93a5e1a7f3d9a639e8b661.tar.gz |
RIO-5073: Add OMX AVC support to 2way
Diffstat (limited to 'protocols')
10 files changed, 717 insertions, 244 deletions
diff --git a/protocols/systems/3g-324m_pvterminal/common/include/h324utils.h b/protocols/systems/3g-324m_pvterminal/common/include/h324utils.h index fc44d1f31..fc0c73c61 100644 --- a/protocols/systems/3g-324m_pvterminal/common/include/h324utils.h +++ b/protocols/systems/3g-324m_pvterminal/common/include/h324utils.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ PVCodecType_t GetUiCodecTypeFrom245Index(int32 index); void GetCodecInfo(PS_Capability capability, CodecCapabilityInfo& info); ErrorProtectionLevel_t GetEpl(uint16 al_index); void printBuffer(PVLogger* logger, const uint8* buffer, uint16 len); -unsigned GetFormatSpecificInfo(PS_DataType pDataType, uint8*& fsi); +uint32 GetFormatSpecificInfo(PS_DataType pDataType, uint8*& fsi); PS_Capability LookupCapability(PS_TerminalCapabilitySet pTcs, uint16 cap_entry_num); bool IsTransmitOnlyAltCapSet(PS_TerminalCapabilitySet pTcs, PS_AlternativeCapabilitySet pAltCapSet); PVMFStatus VerifyCodecs(PS_TerminalCapabilitySet pTcs, @@ -127,7 +127,9 @@ void FillG723Capability(PS_G7231 g723caps); CodecCapabilityInfo* GetCodecCapabilityInfo(PS_G7231 capability); void FillAmrCapability(PS_GenericCapability amrCaps); CodecCapabilityInfo* GetCodecCapabilityInfoAmr(PS_GenericCapability capability); +void FillH264Capability(VideoCodecCapabilityInfo& video_codec_info, PS_GenericCapability h264caps, bool includeCsi); CodecCapabilityInfo* GetCodecCapabilityInfoAvc(PS_GenericCapability capability); +void ParseH264Capability(PS_GenericCapability h264caps, CPvtAvcCapability& h264Capability); void FillM4vCapability(VideoCodecCapabilityInfo& video_codec_info, PS_GenericCapability m4vcaps); CodecCapabilityInfo* GetCodecCapabilityInfoMpeg4(PS_GenericCapability capability); void FillUserInputCapability(CodecCapabilityInfo& codec_info, PS_UserInputCapability userinputCaps); @@ -140,7 +142,16 @@ unsigned GetMaxFrameRate_AVC(PS_GenericCapability avcCaps); unsigned GetMaxBitrate(PS_DataType pDataType); unsigned GetVideoFrameSize(PS_DataType pDataType, bool width); unsigned GetVideoFrameSize_H263(PS_H263VideoCapability h263caps, bool width); -unsigned GetVideoFrameSize_M4V(PS_GenericCapability m4vcaps , bool width); +unsigned GetVideoFrameSize_M4V(PS_GenericCapability m4vcaps, bool width); + +/** + * Get video size from H.264 capability + * + * @param aAvcCaps H.264 generic capability struct + * @param aWidth If true will function will return width of video frame, if false it returns height. + * @returns width or height of video frame size depending on aWidth param. + **/ +unsigned GetVideoFrameSize_AVC(PS_GenericCapability aAvcCaps, bool aWidth); bool FindCodecForMediaType(PV2WayMediaType media, Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>&list, int* index); bool IsSupported(Oscl_Vector<H324ChannelParameters, PVMFTscAlloc>& list, PV2WayMediaType media, CodecCapabilityInfo& codec_info, int*index); diff --git a/protocols/systems/3g-324m_pvterminal/common/include/pvt_common.h b/protocols/systems/3g-324m_pvterminal/common/include/pvt_common.h index e71f7f594..cfa5b9b55 100644 --- a/protocols/systems/3g-324m_pvterminal/common/include/pvt_common.h +++ b/protocols/systems/3g-324m_pvterminal/common/include/pvt_common.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -403,8 +403,16 @@ class CPvtVideoCapability : public CPvtMediaCapability { public: CPvtVideoCapability(PVMFFormatType format_type, uint32 bitrate = 0, bool aMandatory = false) - : CPvtMediaCapability(format_type, bitrate, aMandatory) {} - virtual ~CPvtVideoCapability() { } + : CPvtMediaCapability(format_type, bitrate, aMandatory) + { + iVideoResolution = OSCL_NEW(PVMFVideoResolution, (0, 0)); + iFrameRate = 0; + } + ~CPvtVideoCapability() + { + if (iVideoResolution) + OSCL_DELETE(iVideoResolution); + } PVMFFormatType GetFormatType()const { return iFormatType; @@ -413,10 +421,20 @@ class CPvtVideoCapability : public CPvtMediaCapability { return iBitrate; } - virtual PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) = 0; - virtual void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) = 0; + PVMFVideoResolution* GetMaxResolution(uint32& aFrameRate) + { + aFrameRate = iFrameRate; + return iVideoResolution; + } + void SetMaxResolution(PVMFVideoResolution aVideoResolution, uint32 aFrameRate) + { + *iVideoResolution = aVideoResolution; + iFrameRate = aFrameRate; + } virtual uint16 Getfsi(uint8*& aDecoderConfig) = 0; + PVMFVideoResolution *iVideoResolution; + uint32 iFrameRate; }; @@ -428,10 +446,7 @@ class CPvtMpeg4Capability : public CPvtVideoCapability iProfile = -1; iLevel = -1; iDecoderConfigLen = 0; - iVideoResolution = OSCL_NEW(PVMFVideoResolution, (0, 0)); iGenericCapability = NULL; - iFrameRate = 0; - } ~CPvtMpeg4Capability() { @@ -439,24 +454,6 @@ class CPvtMpeg4Capability : public CPvtVideoCapability { OSCL_DEFAULT_FREE(iDecoderConfig); } - if (iVideoResolution) - { - OSCL_DELETE(iVideoResolution); - iVideoResolution = NULL; - } - } - - void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) - { - iVideoResolution->width = (uint16)width; - iVideoResolution->height = (uint16)height; - iFrameRate = frame_rate; - } - - PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) - { - frame_rate = iFrameRate; - return iVideoResolution; } uint16 Getfsi(uint8*& aDecoderConfig) @@ -465,15 +462,13 @@ class CPvtMpeg4Capability : public CPvtVideoCapability return iDecoderConfigLen; } - - int32 iProfile; int32 iLevel; uint8* iDecoderConfig; uint16 iDecoderConfigLen; PS_GenericCapability iGenericCapability; - PVMFVideoResolution *iVideoResolution; - uint32 iFrameRate; + + }; class CPvtH263Capability : public CPvtVideoCapability @@ -481,43 +476,64 @@ class CPvtH263Capability : public CPvtVideoCapability public: CPvtH263Capability(uint32 bitrate = 0) : CPvtVideoCapability(PVMF_MIME_H2632000, bitrate, true) { - iVideoResolution = OSCL_NEW(PVMFVideoResolution, (0, 0)); iH263VideoCapability = NULL; - iFrameRate = 0; } ~CPvtH263Capability() { - if (iVideoResolution) - OSCL_DELETE(iVideoResolution); - } - - - void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) - { - iVideoResolution->width = (uint16)width; - iVideoResolution->height = (uint16)height; - iFrameRate = frame_rate; } - PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) - { - - frame_rate = iFrameRate; - return iVideoResolution; - } uint16 Getfsi(uint8*& aDecoderConfig) { OSCL_UNUSED_ARG(aDecoderConfig); return 0; } - - PVMFVideoResolution *iVideoResolution; - uint32 iFrameRate; PS_H263VideoCapability iH263VideoCapability; }; +class CPvtAvcCapability : public CPvtVideoCapability +{ + public: + CPvtAvcCapability(uint32 bitrate = 0) : CPvtVideoCapability(PVMF_MIME_H264_VIDEO_RAW, bitrate, false), iDecoderConfig(NULL) + { + iProfile = -1; + iLevel = -1; + iCustomMaxMBPS = -1; + iCustomMaxFS = -1; + iCustomMaxDPB = -1; + iCustomMaxBRandCPB = -1; + iMaxStaticMBPS = -1; + iMaxRcmdNalUnitSize = 0; + iMaxNalUnitSize = 0; + iDecoderConfigLen = 0; + } + ~CPvtAvcCapability() + { + if (iDecoderConfig) + { + OSCL_DEFAULT_FREE(iDecoderConfig); + } + } + + uint16 Getfsi(uint8*& aDecoderConfig) + { + aDecoderConfig = iDecoderConfig; + return iDecoderConfigLen; + } + + int32 iProfile; + int32 iLevel; + int32 iCustomMaxMBPS; + int32 iCustomMaxFS; + int32 iCustomMaxDPB; + int32 iCustomMaxBRandCPB; + int32 iMaxStaticMBPS; + uint32 iMaxRcmdNalUnitSize; + uint32 iMaxNalUnitSize; + uint8* iDecoderConfig; + uint16 iDecoderConfigLen; +}; class CPvtTerminalCapability { diff --git a/protocols/systems/3g-324m_pvterminal/common/src/h324utils.cpp b/protocols/systems/3g-324m_pvterminal/common/src/h324utils.cpp index 19efa809b..463f2f08d 100644 --- a/protocols/systems/3g-324m_pvterminal/common/src/h324utils.cpp +++ b/protocols/systems/3g-324m_pvterminal/common/src/h324utils.cpp @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ #include "oscl_map.h" #define PV_H245_VERSION 0x0A // 10 +#define PV_H245_SPEC_NUMBER 245 +#define PV_H241_SPEC_NUMBER 241 +#define PV_H245_H263VIDEOCAPABILITY 3 +#define PV_H245_GENERICCAPABILITY 5 OSCL_DLL_ENTRY_POINT_DEFAULT() static const uint32 g_num_ones[] = @@ -91,7 +95,7 @@ PVCodecType_t GetVidCodecTypeFromCapabilityIdentifier(S_CapabilityIdentifierStan identifier.spec_type != 0 || identifier.series_letter != 8) return PV_CODEC_TYPE_NONE; - if (identifier.spec_number == 245) + if (identifier.spec_number == PV_H245_SPEC_NUMBER) { if (identifier.data[0] == 1 && // generic capabilty identifier.data[1] == 0 && // video @@ -100,6 +104,18 @@ PVCodecType_t GetVidCodecTypeFromCapabilityIdentifier(S_CapabilityIdentifierStan return PV_VID_TYPE_MPEG4; } } + else if (identifier.spec_number == PV_H241_SPEC_NUMBER) + { + // H.241 - H.264 Capability Identifier + // {itu-t(0) recommendation(0) h(8) 241 specificVideoCodecCapabilities(0) h264(0) + // generic-capabilities(1)} + if (identifier.data[0] == 0 && /* specificVideoCodecCapabilities */ + identifier.data[1] == 0 && /* h264 */ + identifier.data[2] == 1) /* generic capability */ + { + return PV_VID_TYPE_H264; + } + } return PV_CODEC_TYPE_NONE; } @@ -365,7 +381,7 @@ void FillVideoCapability(VideoCodecCapabilityInfo& video_codec_info, switch (video_codec_info.codec) { case PV_VID_TYPE_H263: - video_capability->index = 3; + video_capability->index = PV_H245_H263VIDEOCAPABILITY; video_capability->h263VideoCapability = (PS_H263VideoCapability)OSCL_DEFAULT_MALLOC( sizeof(S_H263VideoCapability)); @@ -375,7 +391,7 @@ void FillVideoCapability(VideoCodecCapabilityInfo& video_codec_info, video_capability->h263VideoCapability); break; case PV_VID_TYPE_MPEG4: - video_capability->index = 5; + video_capability->index = PV_H245_GENERICCAPABILITY; video_capability->genericVideoCapability = (PS_GenericCapability)OSCL_DEFAULT_MALLOC( sizeof(S_GenericCapability)); @@ -384,6 +400,12 @@ void FillVideoCapability(VideoCodecCapabilityInfo& video_codec_info, FillM4vCapability(video_codec_info, video_capability->genericVideoCapability); break; + case PV_VID_TYPE_H264: + video_capability->index = PV_H245_GENERICCAPABILITY; + video_capability->genericVideoCapability = (PS_GenericCapability)OSCL_DEFAULT_MALLOC(sizeof(S_GenericCapability)); + oscl_memset(video_capability->genericVideoCapability, 0, sizeof(S_GenericCapability)); + FillH264Capability(video_codec_info, video_capability->genericVideoCapability, false); + break; default: break; } @@ -393,9 +415,9 @@ CodecCapabilityInfo* GetCodecCapabilityInfo(PS_VideoCapability capability) { switch (capability->index) { - case 3: + case PV_H245_H263VIDEOCAPABILITY: return GetCodecCapabilityInfo(capability->h263VideoCapability); - case 5: + case PV_H245_GENERICCAPABILITY: return GetCodecCapabilityInfo(capability->genericVideoCapability); default: break; @@ -418,16 +440,203 @@ CodecCapabilityInfo* GetCodecCapabilityInfo(PS_GenericCapability capability) { case PV_VID_TYPE_MPEG4: return GetCodecCapabilityInfoMpeg4(capability); + case PV_VID_TYPE_H264: + return GetCodecCapabilityInfoAvc(capability); default: break; } return NULL; } +void FillH264Capability(VideoCodecCapabilityInfo& video_codec_info, PS_GenericCapability h264caps, bool includeCsi) +{ + /* x15 is a set of 2 GenericParameter(s) */ + uint16 num_generic_parameters = 2; + PS_GenericParameter x15 = (PS_GenericParameter)OSCL_DEFAULT_MALLOC(num_generic_parameters * sizeof(S_GenericParameter)); + oscl_memset(x15, 0, num_generic_parameters*sizeof(S_GenericParameter)); + + /* x13 is a GenericCapability (SEQUENCE) */ + PS_CapabilityIdentifier x14 = &h264caps->capabilityIdentifier; + h264caps->option_of_maxBitRate = ON; + h264caps->maxBitRate = video_codec_info.max_bitrate / 100; + h264caps->option_of_collapsing = ON; + h264caps->option_of_nonCollapsing = OFF; + h264caps->option_of_nonCollapsingRaw = OFF; + h264caps->option_of_transport = OFF; + h264caps->size_of_collapsing = num_generic_parameters; + h264caps->collapsing = x15; + + /* x14 is a CapabilityIdentifier (CHOICE) */ + x14->index = 0; + + /* itu-t(0) recommendation(0) h(8) h241(241) specificVideoCodecCapabilities(0) h264(0) generic-capabilities(1) */ + /* Numbers to be encoded: 0,0,8,241,0,0,1 */ + PS_OBJECTIDENT objident = (PS_OBJECTIDENT)OSCL_DEFAULT_MALLOC(sizeof(S_OBJECTIDENT)); + oscl_memset(objident, 0, sizeof(S_OBJECTIDENT)); + x14->standard = objident; + x14->standard->size = 7; + x14->standard->data = (uint8*)OSCL_DEFAULT_MALLOC(x14->standard->size); + x14->standard->data[0] = 0x00; // 40*first(0)+second(0)=0 + x14->standard->data[1] = 0x08; // h + x14->standard->data[2] = 0x81; // 241 == 11110001, ENCODING == 10000001 01110001 = 0x81 0x71 + x14->standard->data[3] = 0x71; + x14->standard->data[4] = 0x00; // specificVideoCodecCapabilities + x14->standard->data[5] = 0x00; // h264 + x14->standard->data[6] = 0x01; // generic-capabilities + + /* x15[0] is a GenericParameter (SEQUENCE) */ + PS_ParameterIdentifier x16 = &x15[0].parameterIdentifier; + PS_ParameterValue x17 = &x15[0].parameterValue; + x15[0].option_of_supersedes = OFF; + + /* x15[1] is a GenericParameter (SEQUENCE) */ + PS_ParameterIdentifier x18 = &x15[1].parameterIdentifier; + PS_ParameterValue x19 = &x15[1].parameterValue; + x15[1].option_of_supersedes = OFF; + + /* x16 is a ParameterIdentifier (CHOICE) -- Profile */ + x16->index = 0; + x16->standard = 41; + + /* x17 is a ParameterValue (CHOICE) -- Profile */ + x17->index = 1; + x17->booleanArray = 64; + + /* x18 is a ParameterIdentifier (CHOICE) - Level */ + x18->index = 0; + x18->standard = 42; + + /* x19 is a ParameterValue (CHOICE) -Level */ + x19->index = 2; + x19->unsignedMin = 15; + + if (!includeCsi) + return; + + x15 = (PS_GenericParameter)OSCL_DEFAULT_MALLOC(sizeof(S_GenericParameter)); + oscl_memset(x15, 0, sizeof(S_GenericParameter)); + + h264caps->option_of_nonCollapsing = ON; + h264caps->size_of_nonCollapsing = 1; + h264caps->nonCollapsing = x15; + + /* x15[0] is a GenericParameter (SEQUENCE) */ + PS_ParameterIdentifier x20 = &x15[0].parameterIdentifier; + PS_ParameterValue x21 = &x15[0].parameterValue; + x15[0].option_of_supersedes = OFF; + + /* x20 is a ParameterIdentifier (CHOICE) - decoderConfigInfo */ + x20->index = 0; + x20->standard = 43; + + /* x21 is a ParameterValue (CHOICE) - decoderConfigInfo*/ + x21->index = 6; + x21->octetString = (PS_OCTETSTRING) OSCL_DEFAULT_MALLOC(sizeof(S_OCTETSTRING)); + x21->octetString->data = (uint8*)OSCL_DEFAULT_MALLOC(video_codec_info.codec_specific_info_len); + x21->octetString->size = video_codec_info.codec_specific_info_len; + oscl_memcpy(x21->octetString->data, video_codec_info.codec_specific_info, video_codec_info.codec_specific_info_len); +} + +CodecCapabilityInfo* GetCodecCapabilityInfoAvc(PS_GenericCapability h264caps) +{ + VideoCodecCapabilityInfo* cci = new VideoCodecCapabilityInfo(); + OSCL_TRAPSTACK_PUSH(cci); + + cci->codec = PV_VID_TYPE_H264; + cci->max_bitrate = h264caps->maxBitRate; + + CPvtAvcCapability avcCapability; + ParseH264Capability(h264caps, avcCapability); + if (avcCapability.iDecoderConfigLen && + avcCapability.iDecoderConfigLen < MAX_H264_FORMAT_SPECIFIC_INFO_LEN && + avcCapability.iDecoderConfig) + { + cci->codec_specific_info_len = avcCapability.iDecoderConfigLen; + cci->codec_specific_info = (uint8*)OSCL_DEFAULT_MALLOC(cci->codec_specific_info_len); + if (cci->codec_specific_info) + { + oscl_memcpy(cci->codec_specific_info, avcCapability.iDecoderConfig, cci->codec_specific_info_len); + } + } + OSCL_TRAPSTACK_POP(); //cci + return cci; +} + +void ParseH264Capability(PS_GenericCapability h264caps, CPvtAvcCapability& h264Capability) +{ + PS_GenericParameter generic_parameters = NULL; + unsigned size_of_generic_parameters = 0; + unsigned param_num = 0; + + if (h264caps->option_of_nonCollapsing) + { + generic_parameters = h264caps->nonCollapsing; + size_of_generic_parameters = h264caps->size_of_nonCollapsing; + } + for (param_num = 0; param_num < size_of_generic_parameters; param_num++) + { + if (generic_parameters[param_num].parameterIdentifier.index != 0) + continue; + if (generic_parameters[param_num].parameterIdentifier.standard == 43) /* DCI */ + { + h264Capability.iDecoderConfig = (uint8*)OSCL_DEFAULT_MALLOC(generic_parameters[param_num].parameterValue.octetString->size); + if (h264Capability.iDecoderConfig) + { + h264Capability.iDecoderConfigLen = generic_parameters[param_num].parameterValue.octetString->size; + oscl_memcpy(h264Capability.iDecoderConfig, generic_parameters[param_num].parameterValue.octetString->data, h264Capability.iDecoderConfigLen); + } + break; + } + } + generic_parameters = NULL; + size_of_generic_parameters = 0; + + if (h264caps->option_of_collapsing) + { + generic_parameters = h264caps->collapsing; + size_of_generic_parameters = h264caps->size_of_collapsing; + } + + for (param_num = 0; param_num < size_of_generic_parameters; param_num++) + { + switch (generic_parameters[param_num].parameterIdentifier.index) + { + case 41:/* Profile */ + h264Capability.iProfile = generic_parameters[param_num].parameterValue.booleanArray; + break; + case 42: /* Level */ + h264Capability.iLevel = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 3: /* CustomMaxMBPS */ + h264Capability.iCustomMaxMBPS = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 4: /* CustomMaxFS */ + h264Capability.iCustomMaxFS = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 5: /* CustomMaxDPB */ + h264Capability.iCustomMaxDPB = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 6: /* CustomMaxBRandCPB */ + h264Capability.iCustomMaxBRandCPB = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 7: /* MaxStaticMBPS */ + h264Capability.iMaxStaticMBPS = generic_parameters[param_num].parameterValue.unsignedMin; + break; + case 8: /* max-rcmd-nal-unit-size */ + h264Capability.iMaxRcmdNalUnitSize = generic_parameters[param_num].parameterValue.unsigned32Min; + break; + case 9: /* max-nal-unit-size */ + h264Capability.iMaxNalUnitSize = generic_parameters[param_num].parameterValue.unsigned32Min; + break; + default:/* Profile */ + break; + } + } +} + void FillM4vCapability(VideoCodecCapabilityInfo& video_codec_info, PS_GenericCapability m4vcaps) { - OSCL_UNUSED_ARG(video_codec_info); // x15 is a set of 1 GenericParameter(s) unsigned num_generic_parameters = 1; PS_GenericParameter x15 = (PS_GenericParameter)OSCL_DEFAULT_MALLOC(num_generic_parameters * @@ -437,7 +646,7 @@ void FillM4vCapability(VideoCodecCapabilityInfo& video_codec_info, // x13 is a GenericCapability (SEQUENCE) PS_CapabilityIdentifier x14 = &m4vcaps->capabilityIdentifier; m4vcaps->option_of_maxBitRate = ON; - m4vcaps->maxBitRate = 521; + m4vcaps->maxBitRate = video_codec_info.max_bitrate / 100; m4vcaps->option_of_collapsing = OFF; m4vcaps->option_of_nonCollapsing = ON; m4vcaps->size_of_nonCollapsing = 1; @@ -516,7 +725,7 @@ void FillH263Capability(VideoCodecCapabilityInfo& video_codec_info, h263caps->option_of_cif16MPI = ON; h263caps->cif16MPI = 2; } - h263caps->maxBitRate = 521; + h263caps->maxBitRate = video_codec_info.max_bitrate / 100; h263caps->unrestrictedVector = OFF; h263caps->arithmeticCoding = OFF; h263caps->advancedPrediction = OFF; @@ -795,11 +1004,11 @@ PVCodecType_t GetCodecType(PS_DataType pDataType) } else if (pDataType->index == 2) { // videoData - if (pDataType->videoData->index == 3) + if (pDataType->videoData->index == PV_H245_H263VIDEOCAPABILITY) { // H263VideoCapability codecIndex = PV_VID_TYPE_H263; } - else if (pDataType->videoData->index == 5) + else if (pDataType->videoData->index == PV_H245_GENERICCAPABILITY) { // GenericVideoCapability codecIndex = GetVidCodecTypeFromVideoCapability(pDataType->videoData); } @@ -921,8 +1130,8 @@ void printBuffer(PVLogger* logger, OSCL_DEFAULT_FREE(cpysave); } -unsigned GetFormatSpecificInfo(PS_DataType dataType, - uint8*& fsi) +uint32 GetFormatSpecificInfo(PS_DataType dataType, + uint8*& fsi) { uint32 size = 0; PS_GenericParameter parameter_list = NULL, parameter = NULL; @@ -932,7 +1141,7 @@ unsigned GetFormatSpecificInfo(PS_DataType dataType, if (!dataType || (dataType->index != 2) || // videoData - (dataType->videoData->index != 5)) // genericVideoCapability + (dataType->videoData->index != PV_H245_GENERICCAPABILITY)) // genericVideoCapability return ret; if (dataType->videoData->genericVideoCapability->option_of_nonCollapsing) @@ -1390,6 +1599,8 @@ unsigned GetMaxFrameRate(PS_DataType pDataType) case PV_VID_TYPE_MPEG4: return GetMaxFrameRate_M4V( pDataType->videoData->genericVideoCapability); + case PV_VID_TYPE_H264: + return GetMaxFrameRate_AVC(pDataType->videoData->genericVideoCapability); case PV_AUD_TYPE_GSM: return 50; case PV_AUD_TYPE_G723: @@ -1411,6 +1622,9 @@ unsigned GetVideoFrameSize(PS_DataType pDataType, bool width) case PV_VID_TYPE_MPEG4: return GetVideoFrameSize_M4V( pDataType->videoData->genericVideoCapability, width); + case PV_VID_TYPE_H264: + return GetVideoFrameSize_AVC( + pDataType->videoData->genericVideoCapability, width); case PV_AUD_TYPE_GSM: return 0; case PV_AUD_TYPE_G723: @@ -1489,6 +1703,11 @@ unsigned GetMaxFrameRate_M4V(PS_GenericCapability m4vcaps) return 15; } +unsigned GetMaxFrameRate_AVC(PS_GenericCapability avcCaps) +{ + OSCL_UNUSED_ARG(avcCaps); + return 15; +} unsigned GetVideoFrameSize_H263(PS_H263VideoCapability h263caps, bool width) { unsigned frame_width = 0; @@ -1526,7 +1745,7 @@ unsigned GetVideoFrameSize_H263(PS_H263VideoCapability h263caps, bool width) } -unsigned GetVideoFrameSize_M4V(PS_GenericCapability m4vcaps , bool width) +unsigned GetVideoFrameSize_M4V(PS_GenericCapability m4vcaps, bool width) { OSCL_UNUSED_ARG(m4vcaps); if (width == true) @@ -1539,6 +1758,19 @@ unsigned GetVideoFrameSize_M4V(PS_GenericCapability m4vcaps , bool width) } } +unsigned GetVideoFrameSize_AVC(PS_GenericCapability aAvcCaps, bool aWidth) +{ + OSCL_UNUSED_ARG(aAvcCaps); + if (aWidth == true) + { + return 176; + } + else + { + return 144; + } +} + bool FindCodecForMediaType(PV2WayMediaType media, Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>&list, @@ -1679,11 +1911,22 @@ CodecCapabilityInfo* IsSupported(CodecCapabilityInfo* codecInfo, PVMFStatus SetFormatSpecificInfo(PS_DataType pDataType, uint8* fsi, uint32 fsi_len) { PVCodecType_t codec_type = GetCodecType(pDataType); - if (codec_type != PV_VID_TYPE_MPEG4) + uint32 nonCollapsingIndex = 0; + + if (codec_type == PV_VID_TYPE_MPEG4) + { + nonCollapsingIndex = 2; + } + else if (codec_type == PV_VID_TYPE_H264) + { + nonCollapsingIndex = 0; + } + else { return PVMFFailure; } - PS_OCTETSTRING octet_string = pDataType->videoData->genericVideoCapability->nonCollapsing[2].parameterValue.octetString; + + PS_OCTETSTRING octet_string = pDataType->videoData->genericVideoCapability->nonCollapsing[nonCollapsingIndex].parameterValue.octetString; OSCL_ASSERT(octet_string != NULL); if (octet_string->data) { @@ -1695,7 +1938,7 @@ PVMFStatus SetFormatSpecificInfo(PS_DataType pDataType, uint8* fsi, uint32 fsi_l oscl_memcpy(octet_string->data, fsi, fsi_len); - octet_string->size = fsi_len; + octet_string->size = (uint16)fsi_len; return PVMFSuccess; } diff --git a/protocols/systems/3g-324m_pvterminal/common/src/pvt_common.cpp b/protocols/systems/3g-324m_pvterminal/common/src/pvt_common.cpp index 96800185e..4fbe49d34 100644 --- a/protocols/systems/3g-324m_pvterminal/common/src/pvt_common.cpp +++ b/protocols/systems/3g-324m_pvterminal/common/src/pvt_common.cpp @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -438,6 +438,9 @@ OSCL_EXPORT_REF PVMFFormatType PVCodecTypeToPVMFFormatType(PVCodecType_t aCodecT case PV_VID_TYPE_MPEG4: aFormatType = PVMF_MIME_M4V; break; + case PV_VID_TYPE_H264: + aFormatType = PVMF_MIME_H264_VIDEO_RAW; + break; default: break; } @@ -464,6 +467,10 @@ OSCL_EXPORT_REF PVCodecType_t PVMFFormatTypeToPVCodecType(PVMFFormatType aFormat { aCodecType = PV_VID_TYPE_MPEG4; } + else if (aFormatType == PVMF_MIME_H264_VIDEO_RAW) + { + aCodecType = PV_VID_TYPE_H264; + } else if (aFormatType == PVMF_MIME_USERINPUT_BASIC_STRING) { aCodecType = PV_UI_BASIC_STRING; @@ -574,6 +581,7 @@ OSCL_EXPORT_REF PV2WayMediaType GetMediaType(PVCodecType_t codec) break; case PV_VID_TYPE_H263: case PV_VID_TYPE_MPEG4: + case PV_VID_TYPE_H264: media_type = PV_VIDEO; break; case PV_UI_BASIC_STRING: @@ -780,6 +788,7 @@ OSCL_EXPORT_REF bool CodecRequiresFsi(PVCodecType_t codec) switch (codec) { case PV_VID_TYPE_MPEG4: + case PV_VID_TYPE_H264: ret = true; break; default: @@ -795,10 +804,12 @@ OSCL_EXPORT_REF uint32 GetPriorityIndexForPVMFFormatType(PVMFFormatType aFormatT { if (aFormatType == PVMF_MIME_AMR_IF2) return PV2WAY_ENGINE_PRIORITY_INDEX_FOR_FORMAT_TYPE_START; - else if (aFormatType == PVMF_MIME_M4V) + else if (aFormatType == PVMF_MIME_H264_VIDEO_RAW) return PV2WAY_ENGINE_PRIORITY_INDEX_FOR_FORMAT_TYPE_START + 1; - else if (aFormatType == PVMF_MIME_H2632000) + else if (aFormatType == PVMF_MIME_M4V) return PV2WAY_ENGINE_PRIORITY_INDEX_FOR_FORMAT_TYPE_START + 2; + else if (aFormatType == PVMF_MIME_H2632000) + return PV2WAY_ENGINE_PRIORITY_INDEX_FOR_FORMAT_TYPE_START + 3; else return PV2WAY_ENGINE_PRIORITY_INDEX_FOR_FORMAT_TYPE_END; } diff --git a/protocols/systems/3g-324m_pvterminal/h223/include/logicalchannel.h b/protocols/systems/3g-324m_pvterminal/h223/include/logicalchannel.h index 1a8bd5fe6..b39ba5d38 100644 --- a/protocols/systems/3g-324m_pvterminal/h223/include/logicalchannel.h +++ b/protocols/systems/3g-324m_pvterminal/h223/include/logicalchannel.h @@ -75,8 +75,6 @@ #include "pvmi_config_and_capability_utils.h" #endif - - #define INVALID_MUX_CODE 0xFF #define DEF_NUM_MEDIA_DATA 100 #define SKEW_CHECK_INTERVAL 2000 @@ -145,6 +143,7 @@ class H223LogicalChannel : public PvmfPortBaseImpl, /* allocate resources in this function */ virtual void Init() = 0; + virtual TPVDirection GetDirection() = 0; // LogicalChannelInfo virtuals TPVChannelId GetLogicalChannelNumber() @@ -214,7 +213,7 @@ class H223LogicalChannel : public PvmfPortBaseImpl, virtual void Resume(); // Set format specific information - PVMFStatus SetFormatSpecificInfo(uint8* info, uint16 info_len); + PVMFStatus SetFormatSpecificInfo(uint8* info, uint32 info_len); void SetTimestampOffset(uint32 offset) { @@ -266,14 +265,12 @@ class H223LogicalChannel : public PvmfPortBaseImpl, OsclMemAllocator iKvpMemAlloc; uint32 iNumMediaData; uint32 iMaxSduSize; - bool iSendFormatSpecificInfo; uint32 iDatapathLatency; PVMFFormatType iMediaType; bool iPaused; PVMFMediaClock* iClock; int32 iAudioLatency; int32 iVideoLatency; - }; /* For outgoing A/V/C ( to be muxed) */ @@ -425,7 +422,6 @@ class H223OutgoingChannel : public H223LogicalChannel bool iWaitForRandomAccessPoint; uint32 iBufferSizeMs; OsclRefCounterMemFrag iFsiFrag; - }; diff --git a/protocols/systems/3g-324m_pvterminal/h223/src/logicalchannel.cpp b/protocols/systems/3g-324m_pvterminal/h223/src/logicalchannel.cpp index 3f237f75e..74fdf0ca2 100644 --- a/protocols/systems/3g-324m_pvterminal/h223/src/logicalchannel.cpp +++ b/protocols/systems/3g-324m_pvterminal/h223/src/logicalchannel.cpp @@ -69,9 +69,10 @@ #define VOP_START_BYTE_4 0xB6 #define VOP_START_BYTE_5 0xB0 - - - +#define H264_START_BYTE_1 0x00 +#define H264_START_BYTE_2 0x00 +#define H264_START_BYTE_3 0x00 +#define H264_LAST_START_BYTE 0x01 #ifdef LIP_SYNC_TESTING /***********************Outgoing side********************/ @@ -156,13 +157,11 @@ H223LogicalChannel::~H223LogicalChannel() void H223LogicalChannel::Init() { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel::Init")); - iSendFormatSpecificInfo = false; } -PVMFStatus H223LogicalChannel::SetFormatSpecificInfo(uint8* info, uint16 info_len) +PVMFStatus H223LogicalChannel::SetFormatSpecificInfo(uint8* info, uint32 info_len) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LogicalChannel::SetFormatSpecificInfo lcn=%d, info_len=%d, info=%x", lcn, info_len, info)); - iSendFormatSpecificInfo = false; if (iFormatSpecificInfo) { oscl_free(iFormatSpecificInfo); @@ -176,7 +175,6 @@ PVMFStatus H223LogicalChannel::SetFormatSpecificInfo(uint8* info, uint16 info_le iFormatSpecificInfo = (uint8*)oscl_malloc(info_len); oscl_memcpy(iFormatSpecificInfo, info, info_len); iFormatSpecificInfoLen = info_len; - iSendFormatSpecificInfo = true; return PVMFSuccess; } @@ -236,9 +234,6 @@ H223OutgoingChannel::H223OutgoingChannel(TPVChannelId num, iMediaFragGroupAlloc(NULL), iPduPktMemPool(NULL), iMediaDataAlloc(&iMemAlloc) - - - { iLogger = PVLogger::GetLoggerObject("3g324m.h223.H223OutgoingChannel"); iOutgoingVideoLogger = PVLogger::GetLoggerObject("datapath.outgoing.video.h223.lcn"); @@ -441,6 +436,14 @@ PVMFStatus H223OutgoingChannel::PutData(PVMFSharedMediaMsgPtr media_msg) PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - Memory allocation failure on CompletePdu\n")); return PVMFErrOverflow; } + if (iMediaType.isCompressed() && iMediaType.isAudio()) + { + PVMF_OUTGOING_AUDIO_LOGDATATRAFFIC((0, "Stats of the outgoing audio SDU are: timestamp=%u, size=%d", iCurPduTimestamp, sdu_size)); + } + else if (iMediaType.isCompressed() && iMediaType.isVideo()) + { + PVMF_OUTGOING_VIDEO_LOGDATATRAFFIC((0, "Stats of the outgoing video SDU are: timestamp=%u, size=%d", iCurPduTimestamp, sdu_size)); + } sdu_size = 0; } } @@ -478,6 +481,14 @@ PVMFStatus H223OutgoingChannel::PutData(PVMFSharedMediaMsgPtr media_msg) PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::PutData - Memory allocation failure on CompletePdu\n")); return PVMFErrOverflow; } + if (iMediaType.isCompressed() && iMediaType.isAudio()) + { + PVMF_OUTGOING_AUDIO_LOGDATATRAFFIC((0, "Stats of the outgoing audio SDU are: timestamp=%u, size=%d", iCurPduTimestamp, sdu_size)); + } + else if (iMediaType.isCompressed() && iMediaType.isVideo()) + { + PVMF_OUTGOING_VIDEO_LOGDATATRAFFIC((0, "Stats of the outgoing video SDU are: timestamp=%u, size=%d", iCurPduTimestamp, sdu_size)); + } sdu_size = 0; iCurPdu = StartAlPdu(); @@ -496,14 +507,6 @@ PVMFStatus H223OutgoingChannel::PutData(PVMFSharedMediaMsgPtr media_msg) } - if (iMediaType.isCompressed() && iMediaType.isAudio()) - { - PVMF_OUTGOING_AUDIO_LOGDATATRAFFIC((0, "Stats of the outgoing audio SDU are: timestamp=%d, size=%d", iCurPduTimestamp, sdu_size)); - } - else if (iMediaType.isCompressed() && iMediaType.isVideo()) - { - PVMF_OUTGOING_VIDEO_LOGDATATRAFFIC((0, "Stats of the outgoing video SDU are: timestamp=%d, size=%d", iCurPduTimestamp, sdu_size)); - } return ret; } @@ -849,7 +852,7 @@ OSCL_EXPORT_REF PVMFStatus H223OutgoingChannel::PeerConnect(PVMFPortInterface* a PVMFStatus H223OutgoingChannel::NegotiateFSISettings(PvmiCapabilityAndConfig* aConfig) { - PvmiKvp* kvp = NULL; + PvmiKvp* pKvp = NULL; int numParams = 0; // Preconfigured FSI uint8* pc_fsi = NULL; @@ -882,56 +885,64 @@ PVMFStatus H223OutgoingChannel::NegotiateFSISettings(PvmiCapabilityAndConfig* aC { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::NegotiateFSISettings, Failed to set FSI on peer, err=%d", err)); } - // Temp change to return success. Enc node does not support setting FSI yet. This will cause port connect to fail. - return PVMFSuccess; + else + { + // Temp change to return success. Enc node does not support setting FSI yet. This will cause port connect to fail. + return PVMFSuccess; + } } - // No preconfigured FSI. In this case try to get the FSI from the peer. - PVMFStatus status = aConfig->getParametersSync(NULL, (PvmiKeyType)PVMF_FORMAT_SPECIFIC_INFO_KEY, kvp, numParams, NULL); - if (status != PVMFSuccess || numParams != 1) - { - PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::NegotiateFSISettings: Failed to get FSI from peer")); - return PVMFSuccess; - } - else + PVMFStatus status = aConfig->getParametersSync(NULL, (PvmiKeyType)PVMF_FORMAT_SPECIFIC_INFO_KEY, pKvp, numParams, NULL); + + // clean variables if getParametersSync did not do it. + if (PVMFSuccess != status) { - ReceivedFSIFromPeer(kvp); - aConfig->releaseParameters(NULL, kvp, numParams); + pKvp = NULL; + numParams = 0; } + // Even if we do not get FSI from peer port, we should still define empty FSI so that we can go forward with channel opening. + ReceivedFSIFromPeer(pKvp); + aConfig->releaseParameters(NULL, pKvp, numParams); - kvp = NULL; - numParams = 0; - return PVMFSuccess; + return status; } -PVMFStatus H223OutgoingChannel::ReceivedFSIFromPeer(PvmiKvp* kvp) +PVMFStatus H223OutgoingChannel::ReceivedFSIFromPeer(PvmiKvp* pKvp) { - // Create mem frag for VOL header - OsclRefCounter* my_refcnt; - OsclMemAllocDestructDealloc<uint8> my_alloc; - uint aligned_refcnt_size = oscl_mem_aligned_size(sizeof(OsclRefCounterSA< OsclMemAllocDestructDealloc<uint8> >)); - uint8* my_ptr = (uint8*) my_alloc.allocate(aligned_refcnt_size + kvp->length); - my_refcnt = OSCL_PLACEMENT_NEW(my_ptr, OsclRefCounterSA< OsclMemAllocDestructDealloc<uint8> >(my_ptr)); - my_ptr += aligned_refcnt_size; + // Store FSI for later use if we have one + // Send FSI to observer (even if it is empty one) + if (pKvp) + { + // Create mem frag for VOL header + OsclRefCounter* my_refcnt; + OsclMemAllocDestructDealloc<uint8> my_alloc; + uint aligned_refcnt_size = oscl_mem_aligned_size(sizeof(OsclRefCounterSA< OsclMemAllocDestructDealloc<uint8> >)); + uint8* my_ptr = (uint8*) my_alloc.allocate(aligned_refcnt_size + pKvp->length); + my_refcnt = OSCL_PLACEMENT_NEW(my_ptr, OsclRefCounterSA< OsclMemAllocDestructDealloc<uint8> >(my_ptr)); + my_ptr += aligned_refcnt_size; - oscl_memcpy(my_ptr, kvp->value.key_specific_value, kvp->length); + oscl_memcpy(my_ptr, pKvp->value.key_specific_value, pKvp->length); - OsclMemoryFragment memfrag; - memfrag.len = kvp->length; - memfrag.ptr = my_ptr; + OsclMemoryFragment memfrag; + memfrag.len = pKvp->length; + memfrag.ptr = my_ptr; - OsclRefCounterMemFrag configinfo(memfrag, my_refcnt, kvp->length); - iFsiFrag = configinfo; + OsclRefCounterMemFrag configinfo(memfrag, my_refcnt, pKvp->length); + iFsiFrag = configinfo; - SetFormatSpecificInfo((uint8*)kvp->value.key_specific_value, kvp->length); + SetFormatSpecificInfo((uint8*)pKvp->value.key_specific_value, pKvp->length); - iObserver->ReceivedFormatSpecificInfo(lcn, (uint8*)kvp->value.key_specific_value, kvp->length); + iObserver->ReceivedFormatSpecificInfo(lcn, (uint8*)pKvp->value.key_specific_value, pKvp->length); + } + else + { + iObserver->ReceivedFormatSpecificInfo(lcn, NULL, 0); + } return PVMFSuccess; } - PVMFStatus H223OutgoingChannel::NegotiateInputSettings(PvmiCapabilityAndConfig* aConfig) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::NegotiateInputSettings, aConfig=%x", aConfig)); @@ -1151,6 +1162,8 @@ OSCL_EXPORT_REF PVMFStatus H223OutgoingChannel::getParametersSync(PvmiMIOSession parameters[0].value.pChar_value = (char*) PVMF_MIME_YUV420; else if (format == PVMF_MIME_M4V) parameters[0].value.pChar_value = (char*) PVMF_MIME_M4V; + else if (format == PVMF_MIME_H264_VIDEO_RAW) + parameters[0].value.pChar_value = (char*) PVMF_MIME_H264_VIDEO_RAW; else if (format == PVMF_MIME_H2632000) parameters[0].value.pChar_value = (char*) PVMF_MIME_H2632000; else if (format == PVMF_MIME_H2631998) @@ -1299,12 +1312,45 @@ OSCL_EXPORT_REF PVMFStatus H223OutgoingChannel::verifyParametersSync(PvmiMIOSess void H223OutgoingChannel::HandlePortActivity(const PVMFPortActivity &aActivity) { - if (aActivity.iType != PVMF_PORT_ACTIVITY_INCOMING_MSG && - aActivity.iType != PVMF_PORT_ACTIVITY_CONNECTED_PORT_READY) - { - PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::HandlePortActivity Unhandled port activity: %d", aActivity.iType)); - return; + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::HandlePortActivity(%d) lcn(%d)", aActivity.iType, lcn)); + + switch (aActivity.iType) + { + case PVMF_PORT_ACTIVITY_CREATED: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity created")); + return; + case PVMF_PORT_ACTIVITY_DELETED: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity deleted")); + return; + case PVMF_PORT_ACTIVITY_CONNECT: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connect")); + return; + case PVMF_PORT_ACTIVITY_DISCONNECT: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity disconnect")); + return; + case PVMF_PORT_ACTIVITY_OUTGOING_MSG: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing msg")); + return; + case PVMF_PORT_ACTIVITY_INCOMING_MSG: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity incoming msg")); + break; + case PVMF_PORT_ACTIVITY_OUTGOING_QUEUE_BUSY: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing queue busy")); + return; + case PVMF_PORT_ACTIVITY_OUTGOING_QUEUE_READY: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity outgoing queue ready")); + return; + case PVMF_PORT_ACTIVITY_CONNECTED_PORT_BUSY: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connected port busy")); + return; + case PVMF_PORT_ACTIVITY_CONNECTED_PORT_READY: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG, (0, "H223OutgoingChannel::HandlePortActivity connected port ready")); + break; + case PVMF_PORT_ACTIVITY_ERROR: + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "H223OutgoingChannel::HandlePortActivity error")); + return; } + PVMFStatus aStatus; PVMFSharedMediaMsgPtr aMsg; while (IncomingMsgQueueSize()) @@ -1323,6 +1369,8 @@ void H223OutgoingChannel::HandlePortActivity(const PVMFPortActivity &aActivity) break; } } + + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223OutgoingChannel::HandlePortActivity - out")); } OSCL_EXPORT_REF PVMFStatus H223OutgoingControlChannel::PeerConnect(PVMFPortInterface* aPort) @@ -1452,10 +1500,8 @@ H223IncomingChannel::H223IncomingChannel(TPVChannelId num, iVideoFrameNum(0), iMax_Chunk_Size(0), ipVideoFrameReszMemPool(NULL), - ipVideoFrameAlloc(NULL) - - - + ipVideoFrameAlloc(NULL), + ipVideoDataMemPool(NULL) { #ifdef LIP_SYNC_TESTING iParam = ShareParams::Instance(); @@ -1661,11 +1707,6 @@ uint32 H223IncomingChannel::CopyToCurrentFrag(uint8* buf, uint16 len) void H223IncomingChannel::PreAlPduData() { - if (iSendFormatSpecificInfo) - { - SendFormatSpecificInfo(); - } - if (iPaused) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::PreAlPduData Logical channel paused. Dropping media data.")); @@ -1695,7 +1736,6 @@ PVMFStatus H223IncomingChannel::AlPduData(uint8* buf, uint16 len) PVMFStatus H223IncomingChannel::AlDispatch() { - PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223IncomingChannel::AlDispatch lcn=%d, iCurPduSize=%d, sn=%d", lcn, iCurPduSize, iNumSdusIn)); IncomingALPduInfo info; @@ -1774,22 +1814,6 @@ PVMFStatus H223IncomingChannel::AlDispatch() iAlPduMediaData->setErrorsFlag(errorsFlag); status = DispatchOutgoingMsg(aMediaData); - - - -#ifdef LIP_SYNC_TESTING - - if (mediaType.isAudio() || mediaType.isVideo()) - { - OsclRefCounterMemFrag memFrag; - aMediaData->getMediaFragment(0, memFrag); - uint8* buf = (uint8*)memFrag.getMemFragPtr(); - // we are using only full audio frames - DetectFrameBoundary(buf, baseTimestamp); - - } -#endif - ResetAlPdu(); AllocateAlPdu(); return status; @@ -1861,12 +1885,6 @@ PVMFStatus H223IncomingChannel::Connect(PVMFPortInterface* aPort) return status; } - /* Send any format specific info if available */ - if (iSendFormatSpecificInfo) - SendFormatSpecificInfo(); - - - PortActivity(PVMF_PORT_ACTIVITY_CONNECT); return PVMFSuccess; @@ -1895,53 +1913,6 @@ OsclAny H223IncomingChannel::LogStats() PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "Num bytes aborted - %d\n", iNumBytesFlushed)); } - -OsclAny H223IncomingChannel::SendFormatSpecificInfo() -{ - //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223IncomingChannel::SendFormatSpecificInfo lcn=%d, iFormatSpecificInfoLen=%d, iFormatSpecificInfo=%x", lcn,iFormatSpecificInfoLen,iFormatSpecificInfo)); - //printBuffer(iLogger, iFormatSpecificInfo, (uint16)iFormatSpecificInfoLen); - if (!IsConnected()) - { - //PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0,"H223IncomingChannel::SendFormatSpecificInfo ERROR Not connected.")); - //OSCL_LEAVE(PVMFErrNotReady); - return; - } - - // Create mem frag for VOL header - // Create new media data buffer for header fragment - OsclSharedPtr<PVMFMediaDataImpl> hdrImpl = iMediaDataAlloc.allocate(iFormatSpecificInfoLen); - if (!hdrImpl) - { - return; - } - PVMFSharedMediaDataPtr hdrMediaData = PVMFMediaData::createMediaData(hdrImpl); - OsclRefCounterMemFrag myVolHeader; - hdrMediaData->getMediaFragment(0, myVolHeader); - oscl_memcpy(myVolHeader.getMemFragPtr(), iFormatSpecificInfo, iFormatSpecificInfoLen); - myVolHeader.getMemFrag().len = iFormatSpecificInfoLen; - - // Create new media data buffer for the message - OsclSharedPtr<PVMFMediaDataImpl> emptyImpl = iMediaDataAlloc.allocate(0); - if (!emptyImpl) - { - return; - } - PVMFSharedMediaDataPtr volData = PVMFMediaData::createMediaData(emptyImpl); - - // Set format specific info in media data message - volData->setFormatSpecificInfo(myVolHeader); - - // Send VOL header to downstream node - PVMFSharedMediaMsgPtr volMsg; - convertToPVMFMediaMsg(volMsg, volData); - PVMFStatus status = QueueOutgoingMsg(volMsg); - if (status != PVMFSuccess) - { - OSCL_LEAVE(status); - } - iSendFormatSpecificInfo = false; -} - MuxSduData::MuxSduData() { size = 0; @@ -2054,6 +2025,8 @@ OSCL_EXPORT_REF PVMFStatus H223IncomingChannel::getParametersSync(PvmiMIOSession parameters[0].value.pChar_value = (char*) PVMF_MIME_YUV420; else if (format == PVMF_MIME_M4V) parameters[0].value.pChar_value = (char*) PVMF_MIME_M4V; + else if (format == PVMF_MIME_H264_VIDEO_RAW) + parameters[0].value.pChar_value = (char*) PVMF_MIME_H264_VIDEO_RAW; else if (format == PVMF_MIME_H2632000) parameters[0].value.pChar_value = (char*) PVMF_MIME_H2632000; else if (format == PVMF_MIME_H2631998) @@ -2638,7 +2611,6 @@ PVMFStatus H223IncomingChannel::DispatchOutgoingMsg(PVMFSharedMediaDataPtr aMedi oscl_memcpy((uint8 *)curVideoFrag.getMemFragPtr() + iVideoFrame->getFilledSize(), memFrag.getMemFragPtr(), memFrag.getMemFragSize()); iVideoFrame->setMediaFragFilledLen(0, iVideoFrame->getFilledSize() + memFrag.getMemFragSize()); - } } @@ -2646,6 +2618,10 @@ PVMFStatus H223IncomingChannel::DispatchOutgoingMsg(PVMFSharedMediaDataPtr aMedi { // for audio data aMediaData->setMarkerInfo(PVMF_MEDIA_DATA_MARKER_INFO_M_BIT); +#ifdef LIP_SYNC_TESTING + g_IncmAudioTS = aMediaData->getTimestamp(); + CalculateRMSInfo(g_IncmVideoTS, g_IncmAudioTS); +#endif } @@ -2661,6 +2637,8 @@ PVMFStatus H223IncomingChannel::DispatchOutgoingMsg(PVMFSharedMediaDataPtr aMedi } + + } if (!IsConnected()) { @@ -2714,12 +2692,24 @@ bool H223IncomingChannel::CheckFrameBoundary(uint8* aDataPtr, } } - - } - - + // H264 + if ((aDataSize > 2) && + (aDataPtr[0] == H264_START_BYTE_1) && + (aDataPtr[1] == H264_START_BYTE_2)) + { + if (aDataPtr[2] == H264_LAST_START_BYTE) + { + return true; + } + else if (((aDataSize > 3) && + (aDataPtr[2] == H264_START_BYTE_3) && + (aDataPtr[3] == H264_LAST_START_BYTE))) + { + return true; + } + } return false; @@ -2743,6 +2733,10 @@ bool H223IncomingChannel::pvmiSetPortFormatSpecificInfoSync(PvmiCapabilityAndConfig *aPort, const char* aFormatValType) { + uint8* fsi = NULL; + uint32 fsiLen = ::GetFormatSpecificInfo(iDataType, fsi); + SetFormatSpecificInfo(fsi, fsiLen); + /* * Create PvmiKvp for capability settings */ @@ -2815,8 +2809,13 @@ PVMFStatus H223IncomingChannel::SendVideoFrame(PVMFSharedMediaDataPtr aMediaData { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING, (0, "H223IncomingChannel::SendVideoFrame Failed to queue outgoing media message lcn=%d, status=%d", lcn, dispatch_status)); - } + +#ifdef LIP_SYNC_TESTING + g_IncmVideoTS = iVideoFrame->getTimestamp(); + CalculateRMSInfo(g_IncmVideoTS, g_IncmAudioTS); +#endif + iVideoFrame.Unbind(); } diff --git a/protocols/systems/3g-324m_pvterminal/h324/tsc/include/tsc_capability.h b/protocols/systems/3g-324m_pvterminal/h324/tsc/include/tsc_capability.h index a0af1d082..e788cab63 100644 --- a/protocols/systems/3g-324m_pvterminal/h324/tsc/include/tsc_capability.h +++ b/protocols/systems/3g-324m_pvterminal/h324/tsc/include/tsc_capability.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +91,7 @@ class TSC_capability } void ExtractTcsParameters(PS_VideoCapability apVideo, CPvtH263Capability *aMedia_capability); void ExtractTcsParameters(PS_VideoCapability pVideo, CPvtMpeg4Capability *aMedia_capability); + void ExtractTcsParameters(PS_VideoCapability apVideo, CPvtAvcCapability *apMedia_capability); void ParseTcsCapabilities(S_Capability &aCapability, Oscl_Vector<CPvtMediaCapability*, OsclMemAllocator> &aMedia_capability, uint32 userInputCapabilities, S_UserInputCapability *aUserInputCapability); bool IsSegmentable(TPVDirection direction, PV2WayMediaType media_type); diff --git a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_capability.cpp b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_capability.cpp index f0ed48c71..92d478ca6 100644 --- a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_capability.cpp +++ b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_capability.cpp @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,39 @@ #include "tsc_statemanager.h" #include "tsc_component.h" +/* + * ITU-T H.241 (05/2006), 8.3 H.264 capabilities + * "GenericCapability/0.0.8.241.0.0.1", "ITU-T Rec. H.241 H.264 Video Capabilities" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/41", "Profile" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/42", "Level" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/3" , "CustomMaxMBPS" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/4" , "CustomMaxFS" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/5" , "CustomMaxDPB" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/6" , "CustomMaxBRandCPB" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/7" , "MaxStaticMBPS" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/8" , "max-rcmd-nal-unit-size" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/9" , "max-nal-unit-size" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/10", "SampleAspectRatiosSupported" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/11", "AdditionalModesSupported" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/12", "AdditionalDisplayCapabilities" + * + * TS 26.111 H.264 + * "GenericCapability/0.0.8.241.0.0.1/nonCollapsing/43" , "DecoderConfigurationInformation" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/44" , "AcceptRedundantSlices" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/45" , "NalAlignedMode" + * "GenericCapability/0.0.8.241.0.0.1/collapsing/46" , "ProfileIOP" + */ +#define PV_H264_CAPABILITY_DCI 43 +#define PV_H264_CAPABILITY_PROFILE 41 +#define PV_H264_CAPABILITY_LEVEL 42 +#define PV_H264_CAPABILITY_CUSTOMMAXMBPS 3 +#define PV_H264_CAPABILITY_CUSTOMMAXFS 4 +#define PV_H264_CAPABILITY_CUSTOMMAXDPB 5 +#define PV_H264_CAPABILITY_CUSTOMMAXBRANDCPB 6 +#define PV_H264_CAPABILITY_MAXSTATICMBPS 7 +#define PV_H264_CAPABILITY_MAX_RCMD_NAL_UNIT_SIZE 8 +#define PV_H264_CAPABILITY_MAX_NAL_UNIT_SIZE 9 + TSC_capability::~TSC_capability() { Reset(); @@ -118,35 +151,138 @@ void TSC_capability::ExtractTcsParameters(PS_VideoCapability pVideo, CPvtH263Cap if (pVideo->h263VideoCapability->option_of_sqcifMPI) { iTcsIn_H263_sqcifMPI = pVideo->h263VideoCapability->sqcifMPI; - aMedia_capability->SetMaxResolution(128, 96, frame_rate); - + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_SQCIF, frame_rate); } if (pVideo->h263VideoCapability->option_of_qcifMPI) { iTcsIn_H263_qcifMPI = pVideo->h263VideoCapability->qcifMPI; - aMedia_capability->SetMaxResolution(176, 144, frame_rate); + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_QCIF, frame_rate); } if (pVideo->h263VideoCapability->option_of_cifMPI) { iTcsIn_H263_cifMPI = pVideo->h263VideoCapability->cifMPI; - aMedia_capability->SetMaxResolution(352, 288, frame_rate); + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_CIF, frame_rate); } if (pVideo->h263VideoCapability->option_of_cif4MPI) { iTcsIn_H263_4cifMPI = pVideo->h263VideoCapability->cif4MPI; - aMedia_capability->SetMaxResolution(704, 576, frame_rate); + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_4CIF, frame_rate); } if (pVideo->h263VideoCapability->option_of_cif16MPI) { iTcsIn_H263_16cifMPI = pVideo->h263VideoCapability->cif16MPI; - aMedia_capability->SetMaxResolution(1408, 1192, frame_rate); + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_16CIF, frame_rate); } } void TSC_capability::ExtractTcsParameters(PS_VideoCapability pVideo, CPvtMpeg4Capability *aMedia_capability) { int frame_rate = GetMaxFrameRate_M4V(pVideo->genericVideoCapability); - aMedia_capability->SetMaxResolution(176, 144, frame_rate); + aMedia_capability->SetMaxResolution(PVMF_RESOLUTION_QCIF, frame_rate); +} + +void TSC_capability::ExtractTcsParameters(PS_VideoCapability apVideo, CPvtAvcCapability* apMediaCapability) +{ + + PS_GenericParameter pGenericParameters = NULL; + unsigned sizeOfGenericParameters = 0; + unsigned paramNum = 0; + PS_GenericCapability pH264caps = apVideo->genericVideoCapability; + + int frameRate = GetMaxFrameRate_AVC(apVideo->genericVideoCapability); + apMediaCapability->SetMaxResolution(PVMF_RESOLUTION_QCIF, frameRate); + + if (pH264caps->option_of_nonCollapsing) + { + pGenericParameters = pH264caps->nonCollapsing; + sizeOfGenericParameters = pH264caps->size_of_nonCollapsing; + } + for (paramNum = 0; paramNum < sizeOfGenericParameters; paramNum++) + { + if (pGenericParameters[paramNum].parameterIdentifier.index != 0) + continue; + if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_DCI) /* DCI */ + { + apMediaCapability->iDecoderConfig = (uint8*)OSCL_DEFAULT_MALLOC(pGenericParameters[paramNum].parameterValue.octetString->size); + if (apMediaCapability->iDecoderConfig) + { + apMediaCapability->iDecoderConfigLen = pGenericParameters[paramNum].parameterValue.octetString->size; + oscl_memcpy(apMediaCapability->iDecoderConfig, pGenericParameters[paramNum].parameterValue.octetString->data, apMediaCapability->iDecoderConfigLen); + } + break; + } + } + pGenericParameters = NULL; + sizeOfGenericParameters = 0; + + if (pH264caps->option_of_collapsing) + { + pGenericParameters = pH264caps->collapsing; + sizeOfGenericParameters = pH264caps->size_of_collapsing; + } + + for (paramNum = 0; paramNum < sizeOfGenericParameters; paramNum++) + { + if (pGenericParameters[paramNum].parameterIdentifier.index != 0) + continue; + if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_PROFILE) /* Profile */ + { + apMediaCapability->iProfile = pGenericParameters[paramNum].parameterValue.booleanArray; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_LEVEL) /* Level */ + { + apMediaCapability->iLevel = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_CUSTOMMAXMBPS) /* CustomMaxMBPS */ + { + apMediaCapability->iCustomMaxMBPS = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_CUSTOMMAXFS) /* CustomMaxFS */ + { + apMediaCapability->iCustomMaxFS = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_CUSTOMMAXDPB) /* CustomMaxDPB */ + { + apMediaCapability->iCustomMaxDPB = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_CUSTOMMAXBRANDCPB) /* CustomMaxBRandCPB */ + { + apMediaCapability->iCustomMaxBRandCPB = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_MAXSTATICMBPS) /* MaxStaticMBPS */ + { + apMediaCapability->iMaxStaticMBPS = pGenericParameters[paramNum].parameterValue.unsignedMin; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_MAX_RCMD_NAL_UNIT_SIZE) /* max-rcmd-nal-unit-size */ + { + apMediaCapability->iMaxRcmdNalUnitSize = pGenericParameters[paramNum].parameterValue.unsigned32Min; + } + else if (pGenericParameters[paramNum].parameterIdentifier.standard == PV_H264_CAPABILITY_MAX_NAL_UNIT_SIZE) /* max-nal-unit-size */ + { + apMediaCapability->iMaxNalUnitSize = pGenericParameters[paramNum].parameterValue.unsigned32Min; + } + } + + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, + (0, "TSC_capability::ExtractTcsParameters H264 Capability:")); + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, + (0, "Profile=%d,Level=%d,DCI Length=%d", + apMediaCapability->iProfile, + apMediaCapability->iLevel, + apMediaCapability->iDecoderConfigLen)); + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, + (0, "CustomMaxMBPS=%d,CustomMaxFS=%d,CustomMaxDPB=%d", + apMediaCapability->iCustomMaxMBPS, + apMediaCapability->iCustomMaxFS, + apMediaCapability->iCustomMaxDPB)); + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, + (0, "CustomMaxBRandCPB=%d,MaxStaticMBPS=%d", + apMediaCapability->iCustomMaxBRandCPB, + apMediaCapability->iMaxStaticMBPS)); + PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, + (0, "max-rcmd-nal-unit-size=%d,max-nal-unit-size=%d", + apMediaCapability->iMaxRcmdNalUnitSize, + apMediaCapability->iMaxNalUnitSize)); } //////////////////////////////////////////////////////////////////////////// @@ -170,22 +306,22 @@ void TSC_capability::ParseTcsCapabilities(S_Capability &aCapability, Oscl_Vector { case 1: // ReceiveVideo PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, - (0, "TSC_capability: Remote video caps ReceiveVideo\n")); + (0, "TSC_capability: Remote caps ReceiveVideo\n")); pVideo = aCapability.receiveVideoCapability; break; case 3: // ReceiveAndTransmitVideo PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, - (0, "TSC_capability: Remote video caps ReceiveAndTransmitVideo\n")); + (0, "TSC_capability: Remote caps ReceiveAndTransmitVideo\n")); pVideo = aCapability.receiveAndTransmitVideoCapability; break; case 4: PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, - (0, "TSC_capability: Remote video caps ReceiveAudio\n")); + (0, "TSC_capability: Remote caps ReceiveAudio\n")); pAudio = aCapability.receiveAudioCapability; break; case 6: PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, - (0, "TSC_capability: Remote video caps ReceiveAndTransmitAudio\n")); + (0, "TSC_capability: Remote caps ReceiveAndTransmitAudio\n")); pAudio = aCapability.receiveAndTransmitAudioCapability; break; case 15: @@ -236,6 +372,13 @@ void TSC_capability::ParseTcsCapabilities(S_Capability &aCapability, Oscl_Vector ((CPvtMpeg4Capability*)media_capability)->iGenericCapability = pVideo->genericVideoCapability; aMedia_capability.push_back(media_capability); } + else if (format_type == PVMF_MIME_H264_VIDEO_RAW) + { + media_capability = new CPvtAvcCapability(); + media_capability->iBitrate = pVideo->genericVideoCapability->maxBitRate; + ExtractTcsParameters(pVideo, (CPvtAvcCapability*)media_capability); + aMedia_capability.push_back(media_capability); + } } else if (pAudio) { @@ -475,6 +618,35 @@ PS_DataType TSC_capability::GetOutgoingDataType(PVCodecType_t codecType, genericCap->option_of_transport = false; } break; + case PV_VID_TYPE_H264: + { + VideoCodecCapabilityInfo h264_info; + h264_info.codec = PV_VID_TYPE_H264; + h264_info.dir = OUTGOING; + h264_info.max_bitrate = bitrate * 100; + if (csi && csi_len) + { + h264_info.codec_specific_info_len = csi_len; + h264_info.codec_specific_info = (uint8*)OSCL_DEFAULT_MALLOC(h264_info.codec_specific_info_len); + oscl_memcpy(h264_info.codec_specific_info, csi, csi_len); + } + else + { + h264_info.codec_specific_info = (uint8*)OSCL_DEFAULT_MALLOC(PV2WAY_FILLER_FSI_LEN); + SetFillerFsi(h264_info.codec_specific_info, PV2WAY_FILLER_FSI_LEN); + h264_info.codec_specific_info_len = PV2WAY_FILLER_FSI_LEN; + } + + pDataType->index = 2; + pDataType->videoData = (PS_VideoCapability) OSCL_DEFAULT_MALLOC(sizeof(S_VideoCapability)); + oscl_memset(pDataType->videoData, 0, sizeof(S_VideoCapability)); + pDataType->videoData->index = 5; + pDataType->videoData->genericVideoCapability = + (PS_GenericCapability) OSCL_DEFAULT_MALLOC(sizeof(S_GenericCapability)); + oscl_memset(pDataType->videoData->genericVideoCapability, 0, sizeof(S_GenericCapability)); + FillH264Capability(h264_info, pDataType->videoData->genericVideoCapability, true); + } + break; default: /* NULL data type */ pDataType->index = 1; @@ -1059,7 +1231,27 @@ TSC_capability::GetDataType(PVCodecType_t codecType, genericCap->option_of_transport = false; } break; - + case PV_VID_TYPE_H264: + { + VideoCodecCapabilityInfo h264_info; + h264_info.codec = PV_VID_TYPE_H264; + h264_info.dir = OUTGOING; + h264_info.codec_specific_info_len = dci_len; + if (dci_len) + { + h264_info.codec_specific_info = (uint8*)OSCL_DEFAULT_MALLOC(MAX_CONFIG_INFO_SIZE); + oscl_memcpy(h264_info.codec_specific_info, dci, dci_len); + } + pDataType->index = 2; + pDataType->videoData = (PS_VideoCapability) OSCL_DEFAULT_MALLOC(sizeof(S_VideoCapability)); + oscl_memset(pDataType->videoData, 0, sizeof(S_VideoCapability)); + pDataType->videoData->index = 5; + pDataType->videoData->genericVideoCapability = + (PS_GenericCapability) OSCL_DEFAULT_MALLOC(sizeof(S_GenericCapability)); + oscl_memset(pDataType->videoData->genericVideoCapability, 0, sizeof(S_GenericCapability)); + FillH264Capability(h264_info, pDataType->videoData->genericVideoCapability, true); + } + break; default: /* NULL data type */ pDataType->index = 1; diff --git a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_channelcontrol.cpp b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_channelcontrol.cpp index 54e97fe3f..270ff7069 100644 --- a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_channelcontrol.cpp +++ b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_channelcontrol.cpp @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,17 +45,12 @@ TSC_channelcontrol::TSC_channelcontrol(OlcList& aOlcs, iTSCclc(aTSCclc), iTSCcomponent(aTSCcomponent) { - iTSCcomponent->addRef(); iLogger = PVLogger::GetLoggerObject("3g324m.h245user"); }; void TSC_channelcontrol::Reset() { - if (iTSCcomponent) - { - iTSCcomponent->removeRef(); - } iTSCcomponent = NULL; } diff --git a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_component.cpp b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_component.cpp index eaf91388e..affd6d10a 100644 --- a/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_component.cpp +++ b/protocols/systems/3g-324m_pvterminal/h324/tsc/src/tsc_component.cpp @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -390,6 +390,15 @@ bool TSC_component::CEStart() } info->codec = codec_type; info->dir = dir; + // get max bitrate from codec, if it is not available get it from channel + if ((*codecs)[m].bitrate) + { + info->max_bitrate = (*codecs)[m].bitrate; + } + else + { + info->max_bitrate = (*iIncomingChannelConfig)[n].GetBandwidth(); + } incoming_codecs.push_back(info); } } @@ -855,7 +864,7 @@ uint32 TSC_component::LcEtbIdc(PS_ControlMsgHeader pReceiveInf) } uint8* fsi = NULL; - uint32 fsi_len = ::GetFormatSpecificInfo(pDataType, fsi); + uint32 fsi_len = ::GetFormatSpecificInfo(&(pLcParam->forwardLogicalChannelParameters.dataType), fsi); iTSCObserver->IncomingChannel(OpenLcn, incoming_codec_type, fsi, fsi_len); // ESTABLISH.response(LC) Primitive Send |