Skip to content

Commit

Permalink
Fix: Subtitle Track Playhead is dependant Of Video Track (#302)
Browse files Browse the repository at this point in the history
* chore: first version of seperate fn for audio increment + unit tests

* fix: HA demux audio incr not in sync

* test: for new increment function

* test: add more cases

* chore: cleaner Increment logs

* bump hls-vodtolive v4.1.1

* Merge branch 'master' into fix/independent-subtitle-playhead

Merge branch 'fix/independent-subtitle-playhead' of https://github.com/Eyevinn/channel-engine into fix/independent-subtitle-playhead
  • Loading branch information
Nfrederiksen authored Nov 21, 2023
1 parent 62e6561 commit c94b072
Show file tree
Hide file tree
Showing 3 changed files with 310 additions and 250 deletions.
15 changes: 12 additions & 3 deletions engine/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,19 @@ class Session {
const mediaSequenceValueAudio = currentVod.mediaSequenceValuesAudio[playheadState.vodMediaSeqAudio];
audioInfo = ` mseq[A]={${playheadState.mediaSeqAudio + mediaSequenceValueAudio}}`
}
debug(`[${this._sessionId}]: Session can now serve mseq[V]={${playheadState.mediaSeq + mediaSequenceValue}}` + audioInfo);
let subsInfo = "";
if (this.use_vtt_subtitles) {
const mediaSequenceValueSubtitle = currentVod.mediaSequenceValuesSubtitle[playheadState.vodMediaSeqSubtitle];
subsInfo = ` mseq[S]={${playheadState.mediaSeqSubtitle + mediaSequenceValueSubtitle}}`
}
debug(`[${this._sessionId}]: Session can now serve mseq[V]={${playheadState.mediaSeq + mediaSequenceValue}}` + audioInfo + subsInfo);
}

debug(`[${this._sessionId}]: INCREMENT (mseq=${playheadState.mediaSeq + playheadState.vodMediaSeqVideo}) vodMediaSeq=(${playheadState.vodMediaSeqVideo}_${playheadState.vodMediaSeqAudio} of ${currentVod.getLiveMediaSequencesCount()}_${currentVod.getLiveMediaSequencesCount("audio")})`);
debug(`[${this._sessionId}]: INCREMENT (mseq=${playheadState.mediaSeq + playheadState.vodMediaSeqVideo}) vodMediaSeq=(${playheadState.vodMediaSeqVideo}_${playheadState.vodMediaSeqAudio}${
this.use_vtt_subtitles ? `_${playheadState.vodMediaSeqSubtitle}` : ""
} of ${currentVod.getLiveMediaSequencesCount()}_${currentVod.getLiveMediaSequencesCount("audio")}${
this.use_vtt_subtitles ? `_${currentVod.getLiveMediaSequencesCount("subtitle")})` : ")"
}`);

// As a FOLLOWER, we might need to read up from shared store...
if (playheadState.vodMediaSeqVideo < 2 || playheadState.mediaSeq !== this.prevMediaSeqOffset.video) {
Expand Down Expand Up @@ -2098,7 +2107,7 @@ class Session {
let positionV = _currentPosVideo ? _currentPosVideo / 1000 : 0;
let positionX;
let posDiff;
const threshold = 0.250;
const threshold = 0.500;
while (extraMediaIncrement < _extraSeqFinalIndex) {
const currentPosExtraMedia = (await _getExtraPlayheadPositionAsyncFn(_vodMediaSeqExtra + extraMediaIncrement)) * 1000;
positionX = currentPosExtraMedia ? currentPosExtraMedia / 1000 : 0;
Expand Down
Loading

0 comments on commit c94b072

Please sign in to comment.