ce689aec by Gary Katsevman

Always write out metadata at the start of segments

In some cases (most likely badly encoded video), segments didn't start
with a keyframe so they ended up getting squished because flash didn't
know how to play them.
1 parent 56520081
...@@ -283,7 +283,9 @@ ...@@ -283,7 +283,9 @@
283 newExtraData = new H264ExtraData(); 283 newExtraData = new H264ExtraData();
284 } 284 }
285 285
286 if (h264Frame.keyFrame) { 286 // Check if keyframe and the length of tags.
287 // This makes sure we write metadata on the first frame of a segment.
288 if (h264Frame.keyFrame || this.tags.length === 0) {
287 // Push extra data on every IDR frame in case we did a stream change + seek 289 // Push extra data on every IDR frame in case we did a stream change + seek
288 this.tags.push(oldExtraData.metaDataTag(h264Frame.pts)); 290 this.tags.push(oldExtraData.metaDataTag(h264Frame.pts));
289 this.tags.push(oldExtraData.extraDataTag(h264Frame.pts)); 291 this.tags.push(oldExtraData.extraDataTag(h264Frame.pts));
......