-
Notifications
You must be signed in to change notification settings - Fork 19
Update proposal according to WG directions #66
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
Conversation
This prepares the document for adoption as a WG document.
index.bs
Outdated
@@ -190,6 +190,10 @@ dictionary MediaStreamTrackProcessorInit { | |||
}; | |||
</pre> | |||
|
|||
Note: There is WG consensus that the interface should be exposed on DedicatedWorker. | |||
There is no WG consensus that the interface should not be exposed on Window. |
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'm a bit concerned this double-negative is hard to parse. We normally don't require consensus to not do something, so it would seem more correct to say "There is no WG consensus that the interface should be exposed on Window.".
Or doing the same as for audio would be: "There is no WG consensus on whether or not the interface should be exposed on Window."
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.
"on whether or not" adopted.
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.
Thanks for doing this merge!
I have some concerns around some WebIDL and some audio API surface that remains.
Also, the examples should be updated to show the worker model with transfer of MST. See link to my PR below which has these. But I can also do a separate PR for that if you prefer. LMK.
index.bs
Outdated
@@ -190,6 +190,10 @@ dictionary MediaStreamTrackProcessorInit { | |||
}; | |||
</pre> | |||
|
|||
Note: There is WG consensus that the interface should be exposed on DedicatedWorker. | |||
There is no WG consensus that the interface should not be exposed on Window. |
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.
There is no WG consensus that the interface should not be exposed on Window. | |
There is no WG consensus on whether or not the interface should be exposed on Window. |
index.bs
Outdated
Note: There is consensus in the WG that this interface should be exposed on DedicatedWorker. | ||
There is no consensus in the WG about whether or not it should be exposed on Window. |
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.
Same here
Note: There is consensus in the WG that this interface should be exposed on DedicatedWorker. | |
There is no consensus in the WG about whether or not it should be exposed on Window. | |
Note: There is WG consensus that this interface should be exposed on DedicatedWorker. | |
There is no WG consensus on whether or not it should be exposed on Window. |
Previous proposals for this interface had an API like this: | ||
|
||
<pre class="idl"> | ||
[Exposed=Window,DedicatedWorker] | ||
interface MediaStreamTrackGenerator : MediaStreamTrack { | ||
constructor(MediaStreamTrackGeneratorInit init); | ||
attribute WritableStream writable; // VideoFrame or AudioFrame | ||
}; | ||
|
||
dictionary MediaStreamTrackGeneratorInit { | ||
required DOMString kind; | ||
}; | ||
</pre> |
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.
My understanding of our agreement was that "We document the parts that have consensus in code", i.e. no WebIDL for non-standard APIs, even in notes.
Provided we remove the WebIDL then I like this section. Once we get the actual JS shim in here, then that should be all we need to document I think.
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 agree that we should not try to document non-standard APIs here.
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 disagree on this point. WebIDL is a clearer exposition format than prose, and this is an informative section. Leaving as-is.
index.bs
Outdated
This interface can be shimmed on top of VideoTrackSource like this: | ||
|
||
<pre> | ||
|
||
Javascript goes here when written | ||
|
||
</pre> |
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 we should not document this part. I think driving convergence around the spec means:
We should document how to shim standard APIs on top of non-standard ones.
We should not document how to shim non-standard APIs on top of standard ones.
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.
Hm. This can be left to an advice note when shipping the new interface in preference to the older one.
I can leave it out; the reason to include it would be to prove by code that the new interface can do everything the old interface could.
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.
Removed.
index.bs
Outdated
The VideoTrackSource can be shimmed on top of MediaStreamTrackGenerator like this: | ||
|
||
<pre> | ||
|
||
More Javascript goes here | ||
|
||
</pre> |
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.
This part is good.
index.bs
Outdated
# Considerations for sourcing audio tracks # {#audio-processor} | ||
|
||
These are kept in the document to allow further discussion of audio processing, if | ||
feasible. They do not indicate that the WG has consensus to add audio. |
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.
This section appears to normatively define/alter audio constraints in detail, which I'd consider surface/code. It feels out of place in a document that does not define an API for audio. The fact that this can be done without WebIDL seems like an artifact of our Constrainable pattern and our practice of expressing normative outcomes in tables instead of through algorithms.
Based on our agreement that we "We document the parts that have consensus in code", I would expect this to be removed, unless it can be rewritten to be agnostic to kind. cc @youennf
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.
Agreed this section does not make much sense right now.
It can be revived if there is WG consensus to move on with supporting audio.
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.
This is about preserving previous considerations. This isn't code.
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.
But in the interest of getting this out, replacing it with a note saying "furhter considerations are found in older versions of this spec, pointer will go here".
index.bs
Outdated
</tbody> | ||
</table> | ||
|
||
## Example using audio/video co-processing |
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 the two code examples dedicated to audio need to stay in alvestrand until we adopt an audio API.
Also, all examples are still main-thread based, and show the old API, which I think needs to be updated.
I provided 3 examples (3.1, 3.2. 3.3) in https://jan-ivar.github.io/mediacapture-transform/#examples I recommend we use to show how to transfer MST to a worker and using the API there (with track.readable rewritten to MediaStreamTrackProcessor of course)
index.bs
Outdated
and a video {{MediaStreamTrackGenerator}} accepts {{VideoFrame}} objects. | ||
When a {{VideoFrame}} or {{AudioData}} object is written to | ||
{{MediaStreamTrackGenerator/writable}}, | ||
MediaStream model</a> in the dedicated worker environment. It has a two readonly |
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.
MediaStream model</a> in the dedicated worker environment. It has a two readonly | |
MediaStream model</a> in the dedicated worker environment. It has two readonly |
[Exposed=DedicatedWorker] | ||
interface VideoTrackSource { | ||
constructor(); | ||
readonly attribute WritableStream writable; |
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.
We have Promise<XYZ>
, could we write it as WritableStream<VideoFrame>
?
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.
Don't understand this comment. What are you suggesting?
with |init|.{{MediaStreamTrackGeneratorInit/kind}}. | ||
4. Return |g|. | ||
1. Let |source| be a new {{VideoTrackSource}} object. | ||
1. Let |track| be a new {{MediaStreamTrack}} object, whose {{MediaStreamTrack/kind}} is "video", and whose {{MediaStreamTrack/id}} is a new unique id generated by the user agent. |
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.
We could be using https://w3c.github.io/mediacapture-main/#dfn-initialize-the-underlying-source here to tie source and MediaStreamTrack.
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.
Tried it.
The <dfn>writeFrame</dfn> algorithm is given a |source| and a |frame| as input. It is defined by running the following steps: | ||
1. If |frame| is not a {{VideoFrame}} object, return [=a promise rejected with= a {{TypeError}}. | ||
1. If |source|.`[[isMuted]]` is false, send the media data backing |frame| to all live tracks sourced from |source|. | ||
1. Invoke the `close` method of |frame|. |
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.
Seems good enough for now, I believe there might be cases where the close method will be called too late though so that JS could call close() before running that step for instance. Also, we should handle the case of closed frames.
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.
Let's leave this as a bug. The "close" method of a VideoFrame seems to be idempotent; it sets a bunch of variables, it doesn't read any of them before setting them. But I do wonder if this is consistent with its implementation.
https://w3c.github.io/webcodecs/#close-videoframe
Previous proposals for this interface had an API like this: | ||
|
||
<pre class="idl"> | ||
[Exposed=Window,DedicatedWorker] | ||
interface MediaStreamTrackGenerator : MediaStreamTrack { | ||
constructor(MediaStreamTrackGeneratorInit init); | ||
attribute WritableStream writable; // VideoFrame or AudioFrame | ||
}; | ||
|
||
dictionary MediaStreamTrackGeneratorInit { | ||
required DOMString kind; | ||
}; | ||
</pre> |
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 agree that we should not try to document non-standard APIs here.
index.bs
Outdated
# Considerations for sourcing audio tracks # {#audio-processor} | ||
|
||
These are kept in the document to allow further discussion of audio processing, if | ||
feasible. They do not indicate that the WG has consensus to add audio. |
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.
Agreed this section does not make much sense right now.
It can be revived if there is WG consensus to move on with supporting audio.
I'm interested in getting this to the WG ASAP for the call for adoption, so would be inclined to minimize changes. WDYT about augmenting the backwards compatibility section with an explicit pointer to "older version hosted at..."? |
Removed audio examples and constraints. Changed name to VideoTrackGenerator (personal preference). Added aspirational shim JS.
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.
Addressed a number of comments, and changed name from VideoTrackSource to VideoTrackGenerator (it is a special kind of source, not a generic source object).
Leaving the revision of examples to a later CL (Jan-Ivar will do that better than I can).
PTAL.
index.bs
Outdated
@@ -190,6 +190,10 @@ dictionary MediaStreamTrackProcessorInit { | |||
}; | |||
</pre> | |||
|
|||
Note: There is WG consensus that the interface should be exposed on DedicatedWorker. | |||
There is no WG consensus that the interface should not be exposed on Window. |
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.
"on whether or not" adopted.
with |init|.{{MediaStreamTrackGeneratorInit/kind}}. | ||
4. Return |g|. | ||
1. Let |source| be a new {{VideoTrackSource}} object. | ||
1. Let |track| be a new {{MediaStreamTrack}} object, whose {{MediaStreamTrack/kind}} is "video", and whose {{MediaStreamTrack/id}} is a new unique id generated by the user agent. |
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.
Tried it.
The <dfn>writeFrame</dfn> algorithm is given a |source| and a |frame| as input. It is defined by running the following steps: | ||
1. If |frame| is not a {{VideoFrame}} object, return [=a promise rejected with= a {{TypeError}}. | ||
1. If |source|.`[[isMuted]]` is false, send the media data backing |frame| to all live tracks sourced from |source|. | ||
1. Invoke the `close` method of |frame|. |
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.
Let's leave this as a bug. The "close" method of a VideoFrame seems to be idempotent; it sets a bunch of variables, it doesn't read any of them before setting them. But I do wonder if this is consistent with its implementation.
https://w3c.github.io/webcodecs/#close-videoframe
Previous proposals for this interface had an API like this: | ||
|
||
<pre class="idl"> | ||
[Exposed=Window,DedicatedWorker] | ||
interface MediaStreamTrackGenerator : MediaStreamTrack { | ||
constructor(MediaStreamTrackGeneratorInit init); | ||
attribute WritableStream writable; // VideoFrame or AudioFrame | ||
}; | ||
|
||
dictionary MediaStreamTrackGeneratorInit { | ||
required DOMString kind; | ||
}; | ||
</pre> |
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 disagree on this point. WebIDL is a clearer exposition format than prose, and this is an informative section. Leaving as-is.
index.bs
Outdated
This interface can be shimmed on top of VideoTrackSource like this: | ||
|
||
<pre> | ||
|
||
Javascript goes here when written | ||
|
||
</pre> |
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.
Removed.
index.bs
Outdated
# Considerations for sourcing audio tracks # {#audio-processor} | ||
|
||
These are kept in the document to allow further discussion of audio processing, if | ||
feasible. They do not indicate that the WG has consensus to add audio. |
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.
But in the interest of getting this out, replacing it with a note saying "furhter considerations are found in older versions of this spec, pointer will go here".
It seems ok for the standard draft to acknowledge the initial non standard document it was based upon, for instance as a link in the introduction. |
Sorry for the late reply.
I think the WebIDL should at least be enclosed in a But if we link to the non standard document as Youenn suggests, then I'd prefer we move this WebIDL there. I'll do a PR for examples. |
Added https://github.com/alvestrand/mediacapture-transform/pull/67 |
Good point. I added the enclosing "example" div as a direct commit to main. We'll continue changing the document afterwards. |
I came across this note in https://w3c.github.io/mediacapture-transform/#track-processor-interface:
Trying to figure out what that's about I found my way here. But is there an issue or something tracking this issue? That issue in short is that Chrome exposes |
#23 is where this has been discussed |
This prepares the document for adoption as a WG document.