-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructor frame #223
Constructor frame #223
Changes from 4 commits
03df57b
4f2c438
303d24f
dccb6f6
9739ea1
3c35ee7
417f896
ae86de4
8ae6738
ae0c342
f229c33
18c1b3e
429171d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -426,12 +426,34 @@ dictionary RTCEncodedVideoFrameMetadata { | |
// re-use or extend the equivalent defined in WebCodecs. | ||
[Exposed=(Window,DedicatedWorker), Serializable] | ||
interface RTCEncodedVideoFrame { | ||
constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameMetadata newMetadata); | ||
readonly attribute RTCEncodedVideoFrameType type; | ||
attribute ArrayBuffer data; | ||
RTCEncodedVideoFrameMetadata getMetadata(); | ||
}; | ||
</pre> | ||
|
||
### Constructor ### {#RTCEncodedVideoFrame-members} | ||
<dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members"> | ||
<dt> | ||
<dfn for="RTCEncodedVideoFrame" method>constructor()</dfn> | ||
</dt> | ||
<dd> | ||
<p> | ||
Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. | ||
|
||
When called, run the following steps: | ||
|
||
1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. | ||
1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably want to clone the data and I am not sure it does that there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is meant to do deep clone the data. Does that work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it now to use CloneArrayBuffer definition so that it's more clear. |
||
1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. | ||
1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. | ||
1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably want to make sure that changing value does not change what metadata would be exposed in the newly constructed object. This seems fine as is now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I add the [[metadata]] internal slot in a follow-up change because that would need using this internal slot in the whole encoded-transforms spec, which would be unrelated to this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds fine, but let's add a comment that we want to do a deep copy here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
</p> | ||
</dd> | ||
</dl> | ||
|
||
### Members ### {#RTCEncodedVideoFrame-members} | ||
<dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members"> | ||
<dt> | ||
|
@@ -626,11 +648,32 @@ dictionary RTCEncodedAudioFrameMetadata { | |
<pre class="idl"> | ||
[Exposed=(Window,DedicatedWorker), Serializable] | ||
interface RTCEncodedAudioFrame { | ||
constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameMetadata newMetadata); | ||
attribute ArrayBuffer data; | ||
RTCEncodedAudioFrameMetadata getMetadata(); | ||
}; | ||
</pre> | ||
|
||
### Constructor ### {#RTCEncodedAudioFrame-members} | ||
<dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members"> | ||
<dt> | ||
<dfn for="RTCEncodedAudioFrame" method>constructor()</dfn> | ||
</dt> | ||
<dd> | ||
<p> | ||
Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. | ||
|
||
When called, run the following steps: | ||
|
||
1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. | ||
1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. | ||
1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. | ||
1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. | ||
|
||
</p> | ||
</dd> | ||
</dl> | ||
|
||
### Members ### {#RTCEncodedAudioFrame-members} | ||
<dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members"> | ||
<dt> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer the second argument to be an options object, e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.