-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff67f0f
commit 6677e87
Showing
7 changed files
with
121 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,52 @@ | ||
// ice tuple change detector | ||
import { InboundTrackMonitor } from "../monitors/InboundTrackMonitor"; | ||
import { Detector } from "./Detector"; | ||
|
||
// bufferedoverflowdetector | ||
|
||
export const empty = "empty"; | ||
export class PlayoutDiscrepancyDetector implements Detector { | ||
public readonly name = 'playout-discrepancy-detector'; | ||
|
||
public constructor( | ||
public readonly trackMonitor: InboundTrackMonitor, | ||
) { | ||
} | ||
|
||
private get peerConnection() { | ||
return this.trackMonitor.getPeerConnection(); | ||
} | ||
|
||
private get config() { | ||
return this.peerConnection.parent.config.playoutDiscrepancyDetector; | ||
} | ||
|
||
public active = false; | ||
|
||
public update() { | ||
if (this.config.disabled) return; | ||
|
||
const inboundRtp = this.trackMonitor.getInboundRtp(); | ||
|
||
if (!inboundRtp || !inboundRtp.deltaFramesReceived || !inboundRtp.deltaFramesRendered || !inboundRtp.ewmaFps) return; | ||
|
||
const frameSkew = inboundRtp.deltaFramesReceived - inboundRtp.deltaFramesRendered; | ||
|
||
if (this.active) { | ||
if (frameSkew < this.config.lowSkewThreshold) { | ||
this.active = false; | ||
return; | ||
} | ||
|
||
return; | ||
} | ||
|
||
if (frameSkew < this.config.highSkewThreshold) return; | ||
|
||
this.active = true; | ||
|
||
const clientMonitor = this.peerConnection.parent; | ||
|
||
clientMonitor.emit('inbound-video-playout-discrepancy', { | ||
trackMonitor: this.trackMonitor, | ||
clientMonitor: clientMonitor, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters