File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -4349,12 +4349,20 @@ shaka.hls.HlsParser = class {
43494349 bitrate,
43504350 duration : reference . endTime - reference . startTime ,
43514351 } ) ;
4352+ reference . bandwidth = bitrate ;
43524353 } else if ( bitrates . length ) {
43534354 // It applies to every segment between it and the next EXT-X-BITRATE,
43544355 // so we use the latest bitrate value
43554356 const prevBitrate = bitrates . pop ( ) ;
43564357 prevBitrate . duration += reference . endTime - reference . startTime ;
43574358 bitrates . push ( prevBitrate ) ;
4359+ reference . bandwidth = prevBitrate . bitrate ;
4360+ }
4361+
4362+ if ( reference . bandwidth ) {
4363+ for ( const partial of reference . partialReferences ) {
4364+ partial . bandwidth = reference . bandwidth ;
4365+ }
43584366 }
43594367
43604368 previousReference = reference ;
Original file line number Diff line number Diff line change @@ -407,9 +407,14 @@ shaka.media.SegmentReference = class {
407407 getSize ( ) {
408408 if ( this . endByte ) {
409409 return this . endByte - this . startByte ;
410- } else {
411- return null ;
412410 }
411+ if ( this . bandwidth ) {
412+ const size = this . bandwidth * ( this . endTime - this . startTime ) ;
413+ if ( ! isNaN ( size ) && size > 0 ) {
414+ return size ;
415+ }
416+ }
417+ return null ;
413418 }
414419
415420 /**
You can’t perform that action at this time.
0 commit comments