Skip to content

Commit

Permalink
fix: Fix parsing error on Chromecast when resyncing HLS (shaka-projec…
Browse files Browse the repository at this point in the history
…t#4869)

Setting the timestampOffset requires an abort() in some cases on
Chromecast.

Issue shaka-project#4589
  • Loading branch information
joeyparrish committed Jan 4, 2023
1 parent da21850 commit afca6af
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/media/media_source_engine.js
Expand Up @@ -906,7 +906,18 @@ shaka.media.MediaSourceEngine = class {
*/
async resync(contentType, timestampOffset) {
goog.asserts.assert(this.sequenceMode_,
'resyncAudio only used with sequence mode!');
'resync only used with sequence mode!');
// Queue an abort() to help MSE splice together overlapping segments.
// We set appendWindowEnd when we change periods in DASH content, and the
// period transition may result in overlap.
//
// An abort() also helps with MPEG2-TS. When we append a TS segment, we
// always enter a PARSING_MEDIA_SEGMENT state and we can't change the
// timestamp offset. By calling abort(), we reset the state so we can
// set it.
this.enqueueOperation_(
contentType,
() => this.abort_(contentType));
await this.enqueueOperation_(
contentType,
() => this.setTimestampOffset_(contentType, timestampOffset));
Expand Down

0 comments on commit afca6af

Please sign in to comment.