Remove timestampOffset
Playlist.duration() does a more comprehensive job of managing calculations with PTS values and discontinuities so remove reference on segmentParser.
Showing
3 changed files
with
0 additions
and
32 deletions
... | @@ -31,15 +31,6 @@ | ... | @@ -31,15 +31,6 @@ |
31 | // allow in-band metadata to be observed | 31 | // allow in-band metadata to be observed |
32 | self.metadataStream = new MetadataStream(); | 32 | self.metadataStream = new MetadataStream(); |
33 | 33 | ||
34 | this.mediaTimelineOffset = null; | ||
35 | |||
36 | // The first timestamp value encountered during parsing. This | ||
37 | // value can be used to determine the relative timing between | ||
38 | // frames and the start of the current timestamp sequence. It | ||
39 | // should be reset to null before parsing a segment with | ||
40 | // discontinuous timestamp values from previous segments. | ||
41 | self.timestampOffset = null; | ||
42 | |||
43 | // For information on the FLV format, see | 34 | // For information on the FLV format, see |
44 | // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. | 35 | // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. |
45 | // Technically, this function returns the header and a metadata FLV tag | 36 | // Technically, this function returns the header and a metadata FLV tag |
... | @@ -360,13 +351,6 @@ | ... | @@ -360,13 +351,6 @@ |
360 | // Skip past "optional" portion of PTS header | 351 | // Skip past "optional" portion of PTS header |
361 | offset += pesHeaderLength; | 352 | offset += pesHeaderLength; |
362 | 353 | ||
363 | // keep track of the earliest encounted PTS value so | ||
364 | // external parties can align timestamps across | ||
365 | // discontinuities | ||
366 | if (self.timestampOffset === null) { | ||
367 | self.timestampOffset = pts; | ||
368 | } | ||
369 | |||
370 | if (pid === self.stream.programMapTable[STREAM_TYPES.h264]) { | 354 | if (pid === self.stream.programMapTable[STREAM_TYPES.h264]) { |
371 | h264Stream.setNextTimeStamp(pts, | 355 | h264Stream.setNextTimeStamp(pts, |
372 | dts, | 356 | dts, | ... | ... |
... | @@ -890,13 +890,6 @@ videojs.Hls.prototype.drainBuffer = function(event) { | ... | @@ -890,13 +890,6 @@ videojs.Hls.prototype.drainBuffer = function(event) { |
890 | 890 | ||
891 | event = event || {}; | 891 | event = event || {}; |
892 | 892 | ||
893 | // if this segment starts is the start of a new discontinuity | ||
894 | // sequence, the segment parser's timestamp offset must be | ||
895 | // re-calculated | ||
896 | if (segment.discontinuity) { | ||
897 | this.segmentParser_.timestampOffset = null; | ||
898 | } | ||
899 | |||
900 | // transmux the segment data from MP2T to FLV | 893 | // transmux the segment data from MP2T to FLV |
901 | this.segmentParser_.parseSegmentBinaryData(bytes); | 894 | this.segmentParser_.parseSegmentBinaryData(bytes); |
902 | this.segmentParser_.flushTags(); | 895 | this.segmentParser_.flushTags(); | ... | ... |
... | @@ -104,8 +104,6 @@ var | ... | @@ -104,8 +104,6 @@ var |
104 | return 'flv'; | 104 | return 'flv'; |
105 | }; | 105 | }; |
106 | this.parseSegmentBinaryData = function() {}; | 106 | this.parseSegmentBinaryData = function() {}; |
107 | this.timestampOffset = 0; | ||
108 | this.mediaTimelineOffset = 0; | ||
109 | this.flushTags = function() {}; | 107 | this.flushTags = function() {}; |
110 | this.tagsAvailable = function() { | 108 | this.tagsAvailable = function() { |
111 | return tags.length; | 109 | return tags.length; |
... | @@ -1344,9 +1342,6 @@ test('translates ID3 PTS values to cue media timeline positions', function() { | ... | @@ -1344,9 +1342,6 @@ test('translates ID3 PTS values to cue media timeline positions', function() { |
1344 | openMediaSource(player); | 1342 | openMediaSource(player); |
1345 | 1343 | ||
1346 | player.hls.segmentParser_.parseSegmentBinaryData = function() { | 1344 | player.hls.segmentParser_.parseSegmentBinaryData = function() { |
1347 | // setup the timestamp offset | ||
1348 | this.timestampOffset = tags[0].pts; | ||
1349 | |||
1350 | // trigger a metadata event | 1345 | // trigger a metadata event |
1351 | player.hls.segmentParser_.metadataStream.trigger('data', { | 1346 | player.hls.segmentParser_.metadataStream.trigger('data', { |
1352 | pts: 5 * 1000, | 1347 | pts: 5 * 1000, |
... | @@ -1375,9 +1370,6 @@ test('translates ID3 PTS values across discontinuities', function() { | ... | @@ -1375,9 +1370,6 @@ test('translates ID3 PTS values across discontinuities', function() { |
1375 | openMediaSource(player); | 1370 | openMediaSource(player); |
1376 | 1371 | ||
1377 | player.hls.segmentParser_.parseSegmentBinaryData = function() { | 1372 | player.hls.segmentParser_.parseSegmentBinaryData = function() { |
1378 | if (this.timestampOffset === null) { | ||
1379 | this.timestampOffset = tags[0].pts; | ||
1380 | } | ||
1381 | // trigger a metadata event | 1373 | // trigger a metadata event |
1382 | if (events.length) { | 1374 | if (events.length) { |
1383 | player.hls.segmentParser_.metadataStream.trigger('data', events.shift()); | 1375 | player.hls.segmentParser_.metadataStream.trigger('data', events.shift()); |
... | @@ -1395,7 +1387,6 @@ test('translates ID3 PTS values across discontinuities', function() { | ... | @@ -1395,7 +1387,6 @@ test('translates ID3 PTS values across discontinuities', function() { |
1395 | '1.ts\n'); | 1387 | '1.ts\n'); |
1396 | 1388 | ||
1397 | // segment 0 starts at PTS 14000 and has a cue point at 15000 | 1389 | // segment 0 starts at PTS 14000 and has a cue point at 15000 |
1398 | player.hls.segmentParser_.timestampOffset = 14 * 1000; | ||
1399 | tags.push({ pts: 14 * 1000, bytes: new Uint8Array(1) }, | 1390 | tags.push({ pts: 14 * 1000, bytes: new Uint8Array(1) }, |
1400 | { pts: 24 * 1000, bytes: new Uint8Array(1) }); | 1391 | { pts: 24 * 1000, bytes: new Uint8Array(1) }); |
1401 | events.push({ | 1392 | events.push({ | ... | ... |
-
Please register or sign in to post a comment