File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,7 @@ TransportParseStream.STREAM_TYPES = {
294
294
ElementaryStream = function ( ) {
295
295
var
296
296
self = this ,
297
+ segmentHadPmt = false ,
297
298
// PES packet fragments
298
299
video = {
299
300
data : [ ] ,
@@ -488,6 +489,8 @@ ElementaryStream = function() {
488
489
} ) ;
489
490
}
490
491
492
+ segmentHadPmt = true ;
493
+
491
494
self . trigger ( 'data' , event ) ;
492
495
}
493
496
} ) [ data . type ] ( ) ;
@@ -519,6 +522,42 @@ ElementaryStream = function() {
519
522
} ;
520
523
521
524
this . flush = function ( ) {
525
+ // if on flush we haven't had a pmt emitted
526
+ // and we have a pmt to emit. emit the pmt
527
+ // so that we trigger a trackinfo downstream.
528
+ if ( ! segmentHadPmt && programMapTable ) {
529
+ var
530
+ pmt = {
531
+ type : 'metadata' ,
532
+ tracks : [ ]
533
+ } ;
534
+ // translate audio and video streams to tracks
535
+ if ( programMapTable . video !== null ) {
536
+ pmt . tracks . push ( {
537
+ timelineStartInfo : {
538
+ baseMediaDecodeTime : 0
539
+ } ,
540
+ id : + programMapTable . video ,
541
+ codec : 'avc' ,
542
+ type : 'video'
543
+ } ) ;
544
+ }
545
+
546
+ if ( programMapTable . audio !== null ) {
547
+ pmt . tracks . push ( {
548
+ timelineStartInfo : {
549
+ baseMediaDecodeTime : 0
550
+ } ,
551
+ id : + programMapTable . audio ,
552
+ codec : 'adts' ,
553
+ type : 'audio'
554
+ } ) ;
555
+ }
556
+
557
+ self . trigger ( 'data' , pmt ) ;
558
+ }
559
+
560
+ segmentHadPmt = false ;
522
561
this . flushStreams_ ( ) ;
523
562
this . trigger ( 'done' ) ;
524
563
} ;
You can’t perform that action at this time.
0 commit comments