[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] mp4/payload h264pyld.cpp, 1.19.2.1, 1.19.2.2 mp4apyld.cpp, 1.28, 1.28.2.1
From: yuxinliu () helixcommunity ! org
Date: 2012-07-20 9:05:19
[Download RAW message or body]
Update of /cvsroot/datatype/mp4/payload
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv15779
Modified Files:
Tag: PRODUCER_14_0_RN
h264pyld.cpp mp4apyld.cpp
Log Message:
Synopsis
========
This CR implement Pass through feature for producer.
Branch : PRODUCER_14_0_RN
Suggested by Sujeet
Description:
==========
The most of IP camera support H.264 video encoding from the camera. In this case, HMP \
doesn't need to transcode it again. It saves system resource and content quality. \
If RTSP stream source has H.264/AAC codec, HMP pass through encoded data.
This CR support pass through all input stream at the same time. This CR never support \
pass through one stream and encoder another stream.
My solution:
1 Add two option in input: "PassThroughVideo" and "PassThroughAudio", their default \
value are false. Customer can set PassThroughVideo=true and PassThroughAudio=true to \
enable pass through. If the input video stream is h.264 and audio stream is AAC, and \
the PassThroughVideo and PassThroughAudio are true, HMP will pass through the input \
stream.
2 If pass through is enable, HMP will create a pass through pipeline, like the \
following:
Input filter(Dtdriver-> depacketizer->dtdrreader) ==>packetizer filter==> packetizer \
asm mux filter ==> destination filter(rbs)
Input filter(Dtdriver-> depacketizer->dtdrreader) ==>unpacketizer asm mux filter ==> \
destination filter(file write)
3 Implement audio depacketizer and video depacketizer plug-in so that Dtdriver \
plug-in can depacketizer H264 and AAC stream. 264depacketizer.rar and \
aacdepacketizer.rar are source code of the new depacketizer plug-in. Path of the two \
plug-in are: datatype\mp4\audio\aacdepacketizer.
datatype\mp4\video\264depacketizer.
4 Implement new class CAudioSourceDepacketizer in source file adepacker.cpp and \
adepacker.h. Dtdriver plug-in will through class CAudioSourceDepacketizer to search \
audio depacketizer plug-in, and depacketize input stream.
5 I add a new macro HELIX_FEATURE_PASS_THROUGH into source file h264pyld.cpp and \
mp4apyld.cpp so that Passthrough feature can share source file with other feature. I \
define macro HELIX_FEATURE_PASS_THROUGH at Umakefil of 264depacketizer folder and \
aacdepacketizer folder.
Files affected:
=========
datatype/mp4/payload/h264pyld.cpp
datatype/mp4/payload/mp4apyld.cpp
client_rn/encodesvc/plugins/input/dtdrreader/hxdtdrreader.cpp
client_rn/encodesvc/plugins/input/dtdrreader/hxdtdrreader.h
client_rn/encodesvc/plugins/input/dtdrreader/hxdtdrservice.cpp
client/encodesvc/include/ihxtconstants.h
producerapps/installer/root/xmlschemas/job.3.0.xsd
datatype/tools/dtdriver/decoder/audio/Umakefil
datatype/tools/dtdriver/decoder/common/decslcfn.cpp
datatype/tools/dtdriver/decoder/common/pub/decslcfn.h
datatype/tools/dtdriver/decoder/video/vdepacker.cpp
client/encodesvc/engine/encpipeline/inputpipeline.cpp
client/encodesvc/engine/encpipeline/outputpipeline.cpp
client/encodesvc/engine/encpipeline/outputpipeline.h
client/encodesvc/engine/encsession/inputsource.cpp
client/build/BIF/PRODUCER_14.bif
producerapps_rn/installer/producer/make_tempdir
Testing Performed:
================
Unit Tests:
1. enable pass through by set PassThroughVideo="true", PassThroughVideo="true"
Input: only one audio stream, type is AAC.
Output: save as a MP4 file.
Expected: HMP never decode and encode the input stream, just pass through it.
Real result: Yes
2. enable pass through by set PassThroughVideo="true", PassThroughVideo="true"
Input: only one video stream, type is H264.
Output: save as a MP4 file.
Expected: HMP never decode and encode the input stream, just pass through it.
Real result: Yes
3. enable pass through by set PassThroughVideo="true", PassThroughVideo="true"
Input: two input stream, video is H264, audio is AAC
Output: save as a MP4 file.
Expected: HMP never decode and encode the input stream, just pass through it.
Real result: Yes
4. enable pass through by set PassThroughVideo="true", PassThroughVideo="true"
Input: two input stream, video is H264, audio is AAC
Output: RBS.
Expected: HMP never decode and encode the input stream, just pass through it to \
server. Real result: Yes. But there are some warning message.
5. disable pass through by set PassThroughVideo="false", PassThroughVideo="false"
Input: two input stream, video is H264, audio is AAC
Output: save as a MP4 file.
Expected: HMP will decode and encode the input stream.
Real result: Yes
Unit Tests: None
Leak Tests: None
Performance Tests: N/A
Platforms Tested: win32-i386-vc9
Builds Verified: win32-i386-vc9
QA Hints
no
Index: mp4apyld.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/payload/mp4apyld.cpp,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -d -r1.28 -r1.28.2.1
--- mp4apyld.cpp 13 Jul 2010 07:32:54 -0000 1.28
+++ mp4apyld.cpp 20 Jul 2012 09:03:46 -0000 1.28.2.1
@@ -68,6 +68,10 @@
#include "mp4desc.h"
#include "mp4apyld.h"
#include "mp4pyldutil.h"
+#ifdef HELIX_FEATURE_PASS_THROUGH
+#include "mp4atoms.h"
+#endif
+
#define DEFAULT_AUDIO_CONFIG 0
#define DEFAULT_AUDIO_CONFIG_SIZE 0
@@ -769,8 +773,8 @@
memcpy(m_pAudioConfig, pCodecConfig, m_ulAudioConfigSize); /* \
Flawfinder: ignore */ }
}
-
-#ifdef HELIX_FEATURE_SERVER
+
+#if defined(HELIX_FEATURE_SERVER) || defined(HELIX_FEATURE_PASS_THROUGH)
if (SUCCEEDED(retVal) && m_pAudioConfig)
{
IHXBuffer* pBuffer = NULL;
@@ -783,6 +787,58 @@
pFMTParams->SetPropertyBuffer("AudioSpecificConfig", pBuffer);
}
+#ifdef HELIX_FEATURE_PASS_THROUGH
+ //Set AAC OpaqueData
+ IHXBuffer* pIOpaqueDataBuffer = NULL;
+ IHXBuffer* pDecoderSpecificConfig = pBuffer;
+ retVal = m_pClassFactory->CreateInstance(CLSID_IHXBuffer, (void**) \
&pIOpaqueDataBuffer); +
+ if(SUCCEEDED(retVal))
+ {
+ UINT32 ulBitrate = 0;
+ retVal = pFMTParams->GetPropertyULONG32("AvgBitRate", ulBitrate);
+ //What we get from the encoding codec, is just the ASC. This needs
+ //to be wrapped in an ESD before it is sent along.
+ CMP4Atom_esds* pESDAtom = new CMP4Atom_esds();
+
+ if(pESDAtom)
+ {
+ pESDAtom->SetObjectType(CMP4Atom_esds::OTI_Audio_14496_3);
+ pESDAtom->SetStreamType(CMP4Atom_esds::ST_AudioStream);
+ pESDAtom->SetAvgBitrate( ulBitrate );
+ pESDAtom->SetMaxBitrate( ulBitrate );
+ pESDAtom->SetBufferSizeDB( 6 * 1024 ); //XXXgfw ?? Taken from mp4 \
file writer. + \
pESDAtom->SetDecoderSpecificInfo(pDecoderSpecificConfig->GetBuffer(), \
pDecoderSpecificConfig->GetSize()); +
+ UINT32 ulAtomSize = pESDAtom->GetCurrentSize();
+ UCHAR* pBuf = new UCHAR[ulAtomSize];
+ if(pBuf)
+ {
+ UCHAR* pTmp = pBuf;
+ //Remember, WriteToBuffer gets incremented.
+ retVal = pESDAtom->WriteToBuffer( pTmp );
+
+ //Need to strip off the Atom and Version info that the ESD Atom
+ //writes out, the rest is the raw ESD that we need to pass up \
the + //line. The length of the lead in bytes, 12, never changes.
+ const int knLeadInBytes = 12;
+ if(SUCCEEDED(retVal))
+ {
+ pIOpaqueDataBuffer->SetSize(ulAtomSize-knLeadInBytes);
+ pTmp = pIOpaqueDataBuffer->GetBuffer();
+ memcpy( pTmp, pBuf+knLeadInBytes, ulAtomSize-knLeadInBytes);
+ }
+ }
+ HX_VECTOR_DELETE(pBuf);
+ }
+ HX_DELETE(pESDAtom);
+ }
+ if(SUCCEEDED(retVal))
+ {
+ retVal = pFMTParams->SetPropertyBuffer( "OpaqueData", pIOpaqueDataBuffer \
); + }
+ HX_RELEASE( pIOpaqueDataBuffer );
+#endif //HELIX_FEATURE_PASS_THROUGH
HX_RELEASE(pBuffer);
}
#endif //HELIX_FEATURE_SERVER
Index: h264pyld.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/payload/h264pyld.cpp,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -u -d -r1.19.2.1 -r1.19.2.2
--- h264pyld.cpp 9 Feb 2011 22:43:18 -0000 1.19.2.1
+++ h264pyld.cpp 20 Jul 2012 09:03:45 -0000 1.19.2.2
@@ -72,6 +72,10 @@
#include "rtsputil.h"
#include "h264pyld.h"
+#ifdef HELIX_FEATURE_PASS_THROUGH
+#include "hxmarsh.h"
+#endif
+
/* Defines
*/
#define _OVERALLOC_CODEC_DATA 3
@@ -625,8 +629,8 @@
m_ulSpropMaxDonDiff);
}
-
-#ifdef HELIX_FEATURE_SERVER
+
+#if defined(HELIX_FEATURE_SERVER) || defined(HELIX_FEATURE_PASS_THROUGH)
if (SUCCEEDED(retVal) && m_pBitstreamHeader)
{
IHXBuffer* pBuffer = NULL;
@@ -637,9 +641,26 @@
pBuffer->SetSize(m_ulBitstreamHeaderSize);
memcpy(pBuffer->GetBuffer(), m_pBitstreamHeader, \
m_ulBitstreamHeaderSize);
pHeader->SetPropertyBuffer("AVCConfigurationRecord", pBuffer);
+
+#ifdef HELIX_FEATURE_PASS_THROUGH
+ //create pOpaqueData
+ IHXBuffer* pOpaqueData = NULL;
+ retVal = m_pClassFactory->CreateInstance(CLSID_IHXBuffer, (void**) \
&pOpaqueData); +
+ if(SUCCEEDED(retVal))
+ {
+ pOpaqueData->SetSize(8 + pBuffer->GetSize());
+ UINT8* pStart = pOpaqueData->GetBuffer();
+ putlong(pStart, 8 + pBuffer->GetSize());
+ memcpy(pStart + 4, "avcC", 4);
+ memcpy(pStart + 8, pBuffer->GetBuffer(), pBuffer->GetSize());
+ pHeader->SetPropertyBuffer("OpaqueData", pOpaqueData);
+ }
+ HX_RELEASE(pOpaqueData);
+#endif
}
- HX_RELEASE(pBuffer);
+ HX_RELEASE(pBuffer);
}
#endif //HELIX_FEATURE_SERVER
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic