Skip to content

Commit 71a2372

Browse files
committed
Add captureTimestamp and senderCaptureTimeOffset to frame metadata
Fixes w3c#225
1 parent 4b61373 commit 71a2372

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

index.bs

+103
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ spec:webidl; type:dfn; text:resolve
4848
"CloneArrayBuffer": {
4949
"href": "https://tc39.es/ecma262/#sec-clonearraybuffer",
5050
"title": "CloneArrayBuffer"
51+
},
52+
"RTP-EXT-CAPTURE-TIME": {
53+
"href": "https://webrtc.googlesource.com/src/+/refs/heads/main/docs/native-code/rtp-hdrext/abs-capture-time",
54+
"title": "RTP Header Extension for Absolute Capture Time",
55+
"publisher": "WebRTC Project"
5156
}
5257
}
5358
</pre>
@@ -293,6 +298,10 @@ The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> met
293298

294299
# RTCRtpScriptTransform # {#scriptTransform}
295300

301+
In this section, the capture system refers to the system where media is sourced from and the sender system
302+
refers to the system that is sending RTP and RTCP packets to the receiver system where {{RTCEncodedVideoFrameMetadata}} data
303+
or {{RTCEncodedAudioFrameMetadata}} data is populated.
304+
296305
## <dfn enum>RTCEncodedVideoFrameType</dfn> dictionary ## {#RTCEncodedVideoFrameType}
297306
<pre class="idl">
298307
// New enum for video frame types. Will eventually re-use the equivalent defined
@@ -358,6 +367,8 @@ dictionary RTCEncodedVideoFrameMetadata {
358367
sequence&lt;unsigned long&gt; contributingSources;
359368
long long timestamp; // microseconds
360369
unsigned long rtpTimestamp;
370+
DOMHighResTimeStamp captureTimestamp;
371+
DOMHighResTimeStamp senderCaptureTimeOffset;
361372
DOMString mimeType;
362373
};
363374
</pre>
@@ -430,6 +441,51 @@ dictionary RTCEncodedVideoFrameMetadata {
430441
The RTP timestamp identifier is an unsigned integer value per [[RFC3550]]
431442
that reflects the sampling instant of the first octet in the RTP data packet.
432443
</p>
444+
</dd>
445+
<dt>
446+
<dfn dict-member>captureTimestamp</dfn> <span class="idlMemberType">DOMHighResTimeStamp</span>
447+
</dt>
448+
<dd>
449+
<p>
450+
The {{captureTimestamp}} is the timestamp that, the most recent frame (from an RTP packet
451+
originating from this source) delivered to the {{RTCRtpReceiver}}'s {{MediaStreamTrack}}, was
452+
originally captured. Its reference clock is the capture system's NTP clock (same clock used
453+
to generate NTP timestamps for RTCP sender reports on that system).
454+
455+
On populating this member, the user agent MUST run the following steps:
456+
1. If the relevant RTP packet contains the [[RTP-EXT-CAPTURE-TIME|RTP Header Extension for
457+
Absolute Capture Time]], return the value of the
458+
[[RTP-EXT-CAPTURE-TIME#absolute-capture-timestamp|absolute capture timestamp]] field and
459+
abort these steps.
460+
1. Otherwise, if the relevant RTP packet does not contain the RTP Header Extension for
461+
Absolute Capture Time but a previous RTP packet did, return the result of calculating the
462+
absolute capture timestamp according to [[RTP-EXT-CAPTURE-TIME#timestamp-interpolation|
463+
timestamp interpolation]] and abort these steps.
464+
1. Otherwise, return undefined.
465+
466+
</p>
467+
</dd>
468+
<dt>
469+
<dfn dict-member>senderCaptureTimeOffset</dfn> <span class="idlMemberType">DOMHighResTimeStamp</span>
470+
</dt>
471+
<dd>
472+
<p>
473+
The {{senderCaptureTimeOffset}} is the sender system's estimate of the offset between its own
474+
NTP clock and the capture system's NTP clock, for the same frame that the {{captureTimestamp}} was
475+
originated from.
476+
477+
On populating this member, the user agent MUST run the following steps:
478+
1. If the relevant RTP packet contains the [[RTP-EXT-CAPTURE-TIME|RTP Header Extension for Absolute
479+
Capture Time]] and the estimated [[RTP-EXT-CAPTURE-TIME#estimated-capture-clock-offset|capture
480+
clock offset field]] is present, return the value of the estimated capture clock offset field
481+
and abort these steps.
482+
1. Otherwise, if the relevant RTP packet does not contain the [[RTP-EXT-CAPTURE-TIME|RTP Header
483+
Extension for Absolute Capture Time]]'s [[RTP-EXT-CAPTURE-TIME#estimated-capture-clock-offset|
484+
estimated capture clock offset]] field, but a previous RTP packet did, return the most recent
485+
value that was present and abort these steps.
486+
1. Otherwise, return undefined.
487+
488+
</p>
433489
</dd>
434490
<dt>
435491
<dfn dict-member>mimeType</dfn> <span class="idlMemberType">DOMString</span>
@@ -611,6 +667,8 @@ dictionary RTCEncodedAudioFrameMetadata {
611667
sequence&lt;unsigned long&gt; contributingSources;
612668
short sequenceNumber;
613669
unsigned long rtpTimestamp;
670+
DOMHighResTimeStamp captureTimestamp;
671+
DOMHighResTimeStamp senderCaptureTimeOffset;
614672
DOMString mimeType;
615673
};
616674
</pre>
@@ -664,6 +722,51 @@ dictionary RTCEncodedAudioFrameMetadata {
664722
that reflects the sampling instant of the first octet in the RTP data packet.
665723
</p>
666724
</dd>
725+
<dt>
726+
<dfn dict-member>captureTimestamp</dfn> <span class="idlMemberType">DOMHighResTimeStamp</span>
727+
</dt>
728+
<dd>
729+
<p>
730+
The {{captureTimestamp}} is the timestamp that, the most recent frame (from an RTP packet
731+
originating from this source) delivered to the {{RTCRtpReceiver}}'s {{MediaStreamTrack}}, was
732+
originally captured. Its reference clock is the capture system's NTP clock (same clock used
733+
to generate NTP timestamps for RTCP sender reports on that system).
734+
735+
On populating this member, the user agent MUST run the following steps:
736+
1. If the relevant RTP packet contains the [[RTP-EXT-CAPTURE-TIME|RTP Header Extension for
737+
Absolute Capture Time]], return the value of the
738+
[[RTP-EXT-CAPTURE-TIME#absolute-capture-timestamp|absolute capture timestamp]] field and
739+
abort these steps.
740+
1. Otherwise, if the relevant RTP packet does not contain the RTP Header Extension for
741+
Absolute Capture Time but a previous RTP packet did, return the result of calculating the
742+
absolute capture timestamp according to [[RTP-EXT-CAPTURE-TIME#timestamp-interpolation|
743+
timestamp interpolation]] and abort these steps.
744+
1. Otherwise, return undefined.
745+
746+
</p>
747+
</dd>
748+
<dt>
749+
<dfn dict-member>senderCaptureTimeOffset</dfn> <span class="idlMemberType">DOMHighResTimeStamp</span>
750+
</dt>
751+
<dd>
752+
<p>
753+
The {{senderCaptureTimeOffset}} is the sender system's estimate of the offset between its own
754+
NTP clock and the capture system's NTP clock, for the same frame that the {{captureTimestamp}} was
755+
originated from.
756+
757+
On populating this member, the user agent MUST run the following steps:
758+
1. If the relevant RTP packet contains the [[RTP-EXT-CAPTURE-TIME|RTP Header Extension for Absolute
759+
Capture Time]] and the estimated [[RTP-EXT-CAPTURE-TIME#estimated-capture-clock-offset|capture
760+
clock offset field]] is present, return the value of the estimated capture clock offset field
761+
and abort these steps.
762+
1. Otherwise, if the relevant RTP packet does not contain the [[RTP-EXT-CAPTURE-TIME|RTP Header
763+
Extension for Absolute Capture Time]]'s [[RTP-EXT-CAPTURE-TIME#estimated-capture-clock-offset|
764+
estimated capture clock offset]] field, but a previous RTP packet did, return the most recent
765+
value that was present and abort these steps.
766+
1. Otherwise, return undefined.
767+
768+
</p>
769+
</dd>
667770
<dt>
668771
<dfn dict-member>mimeType</dfn> <span class="idlMemberType">DOMString</span>
669772
</dt>

0 commit comments

Comments
 (0)