@@ -41,9 +41,11 @@ package org.mangui.hls.demux {
4141 private var _pmtId : int ;
4242 /** video PID **/
4343 private var _avcId : int ;
44+ private var _videoPESfound : Boolean ;
4445 /** audio PID **/
4546 private var _audioId : int ;
4647 private var _audioIsAAC : Boolean ;
48+ private var _audioPESfound : Boolean ;
4749 /** ID3 PID **/
4850 private var _id3Id : int ;
4951 /** Vector of audio/video tags **/
@@ -114,6 +116,7 @@ package org.mangui.hls.demux {
114116 _unknownPIDFound = false ;
115117 _pmtId = _avcId = _audioId = _id3Id = - 1 ;
116118 _audioIsAAC = false ;
119+ _audioPESfound = _videoPESfound = false ;
117120 _tags = new Vector .< FLVTag> ();
118121 _timer = new Timer (0 , 0 );
119122 _audioOnly = audioOnly;
@@ -315,6 +318,18 @@ package org.mangui.hls.demux {
315318 _callback_progress (_tags );
316319 _tags = new Vector .< FLVTag> ();
317320 }
321+ if (_avcId !=- 1 && _videoPESfound == false ) {
322+ CONFIG :: LOGGING {
323+ Log . warn ("TS: dereference video PID, as no video found in this fragment" );
324+ }
325+ _avcId = - 1 ;
326+ }
327+ if (_audioId !=- 1 && _audioPESfound == false ) {
328+ CONFIG :: LOGGING {
329+ Log . warn ("TS: dereference audio PID, as no audio found in this fragment" );
330+ }
331+ _audioId = - 1 ;
332+ }
318333 CONFIG :: LOGGING {
319334 Log . debug ("TS: parsing complete" );
320335 }
@@ -323,6 +338,7 @@ package org.mangui.hls.demux {
323338 /** parse ADTS audio PES packet **/
324339 private function _parseADTSPES (pes : PES ) : void {
325340 var stamp : int ;
341+ _audioPESfound = true ;
326342 // check if previous ADTS frame was overflowing.
327343 if (_adtsFrameOverflow && _adtsFrameOverflow . length ) {
328344 // if overflowing, append remaining data from previous frame at the beginning of PES packet
@@ -392,6 +408,7 @@ package org.mangui.hls.demux {
392408 }
393409 return ;
394410 }
411+ _audioPESfound = true ;
395412 var tag : FLVTag = new FLVTag(FLVTag. MP3_RAW , pes. pts, pes. dts, false );
396413 tag. push (pes. data , pes. payload, pes. data . length - pes. payload);
397414 _tags . push (tag);
@@ -404,6 +421,7 @@ package org.mangui.hls.demux {
404421 var sps_found : Boolean = false ;
405422 var pps_found : Boolean = false ;
406423 var frames : Vector .< VideoFrame> = Nalu. getNALU(pes. data , pes. payload);
424+ _videoPESfound = true ;
407425 // If there's no NAL unit, push all data in the previous tag, if any exists
408426 if (! frames. length ) {
409427 if (_curNalUnit ) {
0 commit comments