How to reduce the initialization time of viewing Mpeg2 TS /H.264 stream

How to reduce the initialization time of viewing Mpeg2 TS /H.264 stream

I have a multicast server which encodes captured video as IPP based Mpeg2 TS /H.264 stream, and a net_player which is based on simple_player and acts as a multicast viewer.

The current problem I have is, the viewer always wait quite long time (roughly 1 minutes or so for a 5fps video stream) before it can recognize the video format and then decode the video stream.

Here is some settings parameters on encoder side:

1: H.264 key frame controls interval as 2 (expect it to deliver one key in every two frames):

key_frame_controls.interval = 2;
key_frame_controls.idr_interval = 2;

2: MPEG2 TS muxer parameter:

m_MuxerParams.m_lpDataWriter = &m_Writer;
m_MuxerParams.m_SystemType = UMC:: MPEG2_TRANSPORT_STREAM;
m_MuxerParams.m_nNumberOfTracks = 1;
m_MuxerParams.pTrackParams = new UMC::TrackParams[m_MuxerParams.m_nNumberOfTracks];

a_VideoInfo.clip_info.height = in_imgHeight;
a_VideoInfo.clip_info.width = in_imgWidth;
a_VideoInfo.stream_type = UMC::H264_VIDEO;
a_VideoInfo.color_format = DEFAULT_COLOR_MODE;
a_VideoInfo.interlace_type = UMC::PROGRESSIVE;
a_VideoInfo.bitrate = in_bitrate_bps; // 1000000;
a_VideoInfo.streamPID = 0;
a_VideoInfo.framerate = 30;
a_VideoInfo.duration = 10000000;

m_MuxerParams.pTrackParams[0].type = UMC::VIDEO_TRACK;
m_MuxerParams.pTrackParams[0].info.video = &a_VideoInfo;
m_MuxerParams.pTrackParams[0].bufferParams.m_prefInputBufferSize = 2000000;
m_MuxerParams.pTrackParams[0].bufferParams.m_prefOutputBufferSize = 2000000;

On player side, once the player is started (after server/encoder is started), it would wait there when executing method CodePipeline::SelectSplitter

umcRes = CodecPipeline::SelectSplitter( m_pDataReader,
rControlParams.ulSplitterFlags,
m_pSplitter,
rControlParams.uiSelectedVideoID,
rControlParams.uiSelectedAudioID);

which is calling

Status ThreadedDemuxer::Init(SplitterParams& init)

and wait inside at:

m_OnInit.Wait();

While above code block is expecting a notify call as m_OnInit.Set() (or Reset()) from a seperate thread which is executing method:

Status Mpeg2TsParser::CheckNextData(MediaData *pData, Ipp32u* pTrack)

However, above method keeps skipping package with PID = MPEG2MUX_INITIAL_ES_PID, which is considered as "unregistered PID" and therefore it can not trigger the code which will eventually call m_OnInit.Set() unless PID is changed to ID_TS_PAT (or met other conditions in that method )

I am wondering if some one on this board have any comments or similar experience on how to reduce the initialization time by modifying either the server or the viewer. It seems to me the problem is related with Mpeg2 TS Mux settings, for instance, if PID ID_TS_PAT can appear more frequently?

Thanks!

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.