Skip to content

Commit

Permalink
Add timestampWatermark receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Oct 24, 2023
1 parent 640d9a9 commit 2f4dcc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/peer-connection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global log, PeerConnections, handleTransceiverForInsertableStreams, handleTransceiverForPlayoutDelayHint */
/* global log, PeerConnections, handleTransceiverForInsertableStreams, handleTransceiverForPlayoutDelayHint, videoEndToEndDelayStats */

const timestampInsertableStreams = !!window.PARAMS?.timestampInsertableStreams
const timestampWatermark = !!window.PARAMS?.timestampWatermark

const NativeRTCPeerConnection = window.RTCPeerConnection

Expand Down Expand Up @@ -84,11 +85,19 @@ window.RTCPeerConnection = function (options) {
pc.addEventListener('track', event => {
//log(`RTCPeerConnection-${id} track`)
const { receiver, transceiver } = event
if (receiver?.track && !receiver._encodedStreams) {
if (receiver?.track) {
//log(`RTCPeerConnection-${id} ontrack`, track.kind, event)
if (timestampInsertableStreams) {
handleTransceiverForInsertableStreams(id, transceiver)
}
if (timestampWatermark) {
window.recognizeTimestampWatermark(
receiver?.track,
({ timestamp, delay }) => {
videoEndToEndDelayStats.push(timestamp, delay)
},
)
}
}
handleTransceiverForPlayoutDelayHint(id, transceiver, 'track')
})
Expand Down
2 changes: 2 additions & 0 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@ export class Session extends EventEmitter {

const page = await this.getNewPage(tabIndex)

await page.setBypassCSP(true)

if (this.userAgent) {
await page.setUserAgent(this.userAgent)
}
Expand Down

0 comments on commit 2f4dcc1

Please sign in to comment.