@@ -28,6 +28,27 @@ var VIDEO_PROPERTIES = require('../constants/video-properties.js');
28
28
// object types
29
29
var VideoSegmentStream , AudioSegmentStream , Transmuxer , CoalesceStream ;
30
30
31
+ var retriggerForStream = function ( key , event ) {
32
+ event . stream = key ;
33
+ this . trigger ( 'log' , event ) ;
34
+ } ;
35
+
36
+ var addPipelineLogRetriggers = function ( transmuxer , pipeline ) {
37
+ var keys = Object . keys ( pipeline ) ;
38
+
39
+ for ( var i = 0 ; i < keys . length ; i ++ ) {
40
+ var key = keys [ i ] ;
41
+
42
+ // skip non-stream keys and headOfPipeline
43
+ // which is just a duplicate
44
+ if ( key === 'headOfPipeline' || ! pipeline [ key ] . on ) {
45
+ continue ;
46
+ }
47
+
48
+ pipeline [ key ] . on ( 'log' , retriggerForStream . bind ( transmuxer , key ) ) ;
49
+ }
50
+ } ;
51
+
31
52
/**
32
53
* Compare two arrays (even typed) for same-ness
33
54
*/
@@ -972,6 +993,8 @@ Transmuxer = function(options) {
972
993
pipeline . coalesceStream . on ( 'data' , this . trigger . bind ( this , 'data' ) ) ;
973
994
// Let the consumer know we have finished flushing the entire pipeline
974
995
pipeline . coalesceStream . on ( 'done' , this . trigger . bind ( this , 'done' ) ) ;
996
+
997
+ addPipelineLogRetriggers ( this , pipeline ) ;
975
998
} ;
976
999
977
1000
this . setupTsPipeline = function ( ) {
@@ -1107,6 +1130,8 @@ Transmuxer = function(options) {
1107
1130
pipeline . coalesceStream . on ( 'caption' , this . trigger . bind ( this , 'caption' ) ) ;
1108
1131
// Let the consumer know we have finished flushing the entire pipeline
1109
1132
pipeline . coalesceStream . on ( 'done' , this . trigger . bind ( this , 'done' ) ) ;
1133
+
1134
+ addPipelineLogRetriggers ( this , pipeline ) ;
1110
1135
} ;
1111
1136
1112
1137
// hook up the segment streams once track metadata is delivered
@@ -1181,20 +1206,6 @@ Transmuxer = function(options) {
1181
1206
this . setupTsPipeline ( ) ;
1182
1207
}
1183
1208
1184
- if ( this . transmuxPipeline_ ) {
1185
- var keys = Object . keys ( this . transmuxPipeline_ ) ;
1186
-
1187
- for ( var i = 0 ; i < keys . length ; i ++ ) {
1188
- var key = keys [ i ] ;
1189
-
1190
- // skip non-stream keys and headOfPipeline
1191
- // which is just a duplicate
1192
- if ( key === 'headOfPipeline' || ! this . transmuxPipeline_ [ key ] . on ) {
1193
- continue ;
1194
- }
1195
- this . transmuxPipeline_ [ key ] . on ( 'log' , this . getLogTrigger_ ( key ) ) ;
1196
- }
1197
- }
1198
1209
hasFlushed = false ;
1199
1210
}
1200
1211
this . transmuxPipeline_ . headOfPipeline . push ( data ) ;
0 commit comments