[Live-devel] i can not mix the h264 and ADTS AAC together to VLC player From EasyDarwin

lijun at ndtv.com.cn lijun at ndtv.com.cn
Sun Feb 10 19:00:35 PST 2019


<p>
	I don't get more detail reply , I think  my description is not enough clear,   so after rearrange my word, I submit  it again.
</p>
<p>
	[1]<br />
i have implemented a RTSP Server(like proxy server), packetizing the audio and video stream to TS from EasyDarwin
</p>
<p>
	<br />
</p>
<p>
	[2]<br />
if only have h264 or only have ADTS  AAC stream VLC play is ok.
</p>
<p>
	<br />
</p>
<p>
	[3]<br />
but mixed h264 and ADTS AAC together, after a few seconds VLC only play video.<br />
audio packet will be lost, i see it from the VLC [current media information] dialog -> [statistics] tab -> Lost.
</p>
<p>
	<br />
</p>
<p>
	[4]<br />
my audio stream code as ADTSAudioFileSource
</p>
<p>
	<br />
</p>
<p>
	[5]<br />
my h264 code snippet is  in below<br />
 void BlockSource::doGetNextFrame()<br />
 {<br />
  if (_bFirst)<br />
  {<br />
   fFrameSize = MyExchangeBuffer::Inst().readFirstFromVideoBlock(_strBlockName.c_str(), fTo, fMaxSize);<br />
   _bFirst = false;<br />
  }<br />
  else<br />
  {<br />
   fFrameSize = MyExchangeBuffer::Inst().readFromVideoBlock(_strBlockName.c_str(), _pBlockChunkPointer, fTo, fMaxSize);<br />
  }
</p>
<p>
	     <br />
  gettimeofday(&fPresentationTime, NULL);//i dont know how to set it correctly...<br />
  fDurationInMicroseconds = 1000000 / 22;//i dont know how to dynamic set it, so i set it to 22 fps.
</p>
<p>
	  nextTask() = envir().taskScheduler().scheduleDelayedTask(fDurationInMicroseconds,<br />
   (TaskFunc*)FramedSource::afterGetting, this);<br />
 }
</p>
<p>
	<br />
</p>
<p>
	[6]<br />
my sub session source snippet in below<br />
 FramedSource * TSFromH264BlockServerMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned & estBitrate)<br />
 {<br />
  estBitrate = 2500; // kbps, estimate<br />
  MPEG2TransportStreamFromESSource* tsFrames = MPEG2TransportStreamFromESSource::createNew(envir());<br />
 ...<br />
   BlockSource* blockSource = BlockSource::createNew(envir(), _strBlockName.c_str());//H264 from RTSPClient<br />
  if (blockSource == NULL)<br />
   return NULL;<br />
  H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(envir(), blockSource, True/*includeStartCodeInOutput*/);<br />
  tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/);<br />
  ...<br />
  tsFrames->addNewAudioSource(adtsSource, 4/*mpegVersion: AAC*/);<br />
  return MPEG2TransportStreamFramer::createNew(envir(), tsFrames);//blockSource<br />
 }
</p>
<p>
	 RTPSink * TSFromH264BlockServerMediaSubsession::createNewRTPSink(Groupsock * rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource * inputSource)<br />
 {<br />
  return SimpleRTPSink::createNew(envir(), rtpGroupsock,<br />
   33, 90000, "video", "MP2T",<br />
   1, True, False /*no 'M' bit*/);<br />
 }
</p>
<p>
	[7]<br />
 //pBlockName is a string.<br />
 sms->addSubsession(kagula::TSFromH264BlockServerMediaSubsession::createNew(env, pBlockName, false));<br />
 rtspServer->addServerMediaSession(sms); 
</p>
<p>
	<br />
</p>
<p>
	[8]I need help, any advise will be appreciate
</p>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20190211/316a55c3/attachment.html>


More information about the live-devel mailing list