Skip to content

Commit 650a041

Browse files
Michal Wrobelstschr
authored andcommitted
fix: Fix oldRepresentation retrieval during Period switch
1 parent 59e3263 commit 650a041

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/streaming/Stream.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function Stream(config) {
298298

299299
Promise.all(promises)
300300
.then(() => {
301-
return _createBufferSinks(previousSourceBufferSinks)
301+
return _createBufferSinks(previousSourceBufferSinks, representationsFromPreviousPeriod)
302302
})
303303
.then((bufferSinks) => {
304304
if (streamProcessors.length === 0) {
@@ -527,14 +527,16 @@ function Stream(config) {
527527
/**
528528
* Creates the SourceBufferSink objects for all StreamProcessors
529529
* @param {array} previousSourceBufferSinks
530+
* @param {array} representationsFromPreviousPeriod
530531
* @return {Promise<object>}
531532
* @private
532533
*/
533-
function _createBufferSinks(previousSourceBufferSinks) {
534+
function _createBufferSinks(previousSourceBufferSinks, representationsFromPreviousPeriod) {
534535
return new Promise((resolve) => {
535536
const buffers = {};
536537
const promises = streamProcessors.map((sp) => {
537-
const oldRepresentation = sp.getRepresentation();
538+
const spRepresentation = sp.getRepresentation();
539+
const oldRepresentation = representationsFromPreviousPeriod.find((r) => r.mediaInfo.type === spRepresentation.mediaInfo.type);
538540
return sp.createBufferSinks(previousSourceBufferSinks, oldRepresentation);
539541
});
540542

0 commit comments

Comments
 (0)