Skip to content

Commit

Permalink
perf: PeriodCombiner improvements (#6005)
Browse files Browse the repository at this point in the history
Summary of changes:
- create dummy streams during preparing arrays of input streams
- use hash map to quickly find perfect stream matches across periods
- hash map also automatically removes duplicates, so remove previous
logic for finding them
- check earlier are we trying to create output stream from dummy stream
- 2 changes from above also gives us a possibility to simplify
`areCompatible()` & `isBetterMatch()` methods
- reduce creation of spare collections when concatenating streams
- reduce conditional logic when possible

I was testing `PeriodCombiner.combinePeriods()` performance of mentioned
changes on Tizen 2021 on 2 streams and I've got following results:

| content | upstream | proposed changes |
| - | -: | -: |
| stream 1 | 23 ms | 17 ms |
| stream 2 | 484 ms | 191 ms |

Both streams are VOD.
Stream 1 has 18 periods with 6 video & audio tracks in each.
Stream 2 has 18 periods with 6 video tracks & 36 audio tracks in each.
  • Loading branch information
tykus160 authored and avelad committed Jan 9, 2024
1 parent baa31d2 commit ffd60f1
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 238 deletions.
1 change: 0 additions & 1 deletion lib/dash/dash_parser.js
Expand Up @@ -1609,7 +1609,6 @@ shaka.dash.DashParser = class {
hdr,
videoLayout: undefined,
tilesLayout,
matchedStreams: [],
accessibilityPurpose,
external: false,
fastSwitching: false,
Expand Down

0 comments on commit ffd60f1

Please sign in to comment.