Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ the most recent one.

The UA is also free to remove any frames from the queue at any time. The UA
may remove frames in order to save resources or to improve performance in
specific situations. In all cases, frames that are not dropped
must be made available to the {{ReadableStream}} in the order in which
they arrive to the {{MediaStreamTrackProcessor}}.
specific situations. In this case, `[[numDiscardedFrames]]` MUST be incremented
accordingly. In all cases, frames that are not dropped must be made available
to the {{ReadableStream}} in the order in which they arrive to the
{{MediaStreamTrackProcessor}}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove or reduce this sentence given this is already stated. I filed #126.


A {{MediaStreamTrackProcessor}} makes frames available to its
associated {{ReadableStream}} only when a read request has been issued on
Expand All @@ -126,6 +127,8 @@ interface MediaStreamTrackHandle {
interface MediaStreamTrackProcessor {
constructor(MediaStreamTrackProcessorInit init);
readonly attribute ReadableStream readable;
readonly attribute unsigned long long discardedFrames;
readonly attribute unsigned long long totalFrames;
};

typedef (MediaStreamTrack or MediaStreamTrackHandle) MediaStreamTrackOrHandle;
Expand Down Expand Up @@ -157,7 +160,10 @@ application that have not yet been handled.
</dd>
<dt><dfn attribute for=MediaStreamTrackProcessor>`[[isClosed]]`</dfn></dt>
<dd>An boolean whose value indicates if the {{MediaStreamTrackProcessor}} is closed.
</dd>
<dt><dfn attribute for=MediaStreamTrackProcessor>`[[numDiscardedFrames]]`</dfn></dt>
<dd>The number of frames discarded by this {{MediaStreamTrackProcessor}}.</dd>
<dt><dfn attribute for=MediaStreamTrackProcessor>`[[numTotalFrames]]`</dfn></dt>
<dd>The number of frames received by this {{MediaStreamTrackProcessor}} including discarded frames.</dd>
</dl>

### Constructor ### {#constructor-processor}
Expand All @@ -183,6 +189,8 @@ application that have not yet been handled.
1. Set |processor|.`[[queue]]` to an empty [=queue=].
1. Set |processor|.`[[numPendingReads]]` to 0.
1. Set |processor|.`[[isClosed]]` to false.
1. Set |processor|.`[[numDiscardedFrames]]` to 0.
1. Set |processor|.`[[numTotalFrames]]` to 0.
1. Return |processor|.

### Attributes ### {#attributes-processor}
Expand Down Expand Up @@ -222,6 +230,13 @@ It is defined by running the following steps:
1. Set |processor|.`[[isClosed]]` to true.

</dd>

<dt><dfn attribute for=MediaStreamTrackProcessor>discardedFrames</dfn></dt>
<dd>Returns the value of |processor|.`[[numDiscardedFrames]]`.</dd>

<dt><dfn attribute for=MediaStreamTrackProcessor>totalFrames</dfn></dt>
<dd>Returns the value of |processor|.`[[numTotalFrames]]`.</dd>

</dl>

### Handling interaction with the track ### {#processor-handling-interaction-with-track}
Expand All @@ -234,16 +249,20 @@ It is defined by running the following steps:
1. If |processor|.`[[queue]]` has |processor|.`[[maxBufferSize]]` elements, run the following steps:
1. Let |droppedFrame| be the result of [=queue/dequeueing=] |processor|.`[[queue]]`.
1. Run the [=Close VideoFrame=] algorithm with |droppedFrame|.
2. [=queue/Enqueue=] the new frame media data in |processor|.`[[queue]]`.
3. [=Queue a task=] to run the [=maybeReadFrame=] algorithm with |processor| as parameter.
1. Increment |processor|.`[[numDiscardedFrames]]` by 1.
1. Increment |processor|.`[[numTotalFrames]]` by 1.
Comment thread
guidou marked this conversation as resolved.
1. [=queue/Enqueue=] the new frame media data in |processor|.`[[queue]]`.
1. [=Queue a task=] to run the [=maybeReadFrame=] algorithm with |processor| as parameter.

At any time, the UA MAY [=list/remove=] any frame from |processor|.`[[queue]]`.
The UA may decide to remove frames from |processor|.`[[queue]]`, for example,
Comment thread
guidou marked this conversation as resolved.
to prevent resource exhaustion or to improve performance in certain situations.
In this case, |processor|.`[[numDiscardedFrames]]` MUST be incremented accordingly.

<p class="note">
The application may detect that frames have been dropped by noticing that there
is a gap in the timestamps of the frames.
is a gap in the timestamps of the frames or by looking at
{{MediaStreamTrackProcessor/discardedFrames}}.
</p>

When the `[[track]]` of a {{MediaStreamTrackProcessor}} |processor|
Expand Down
Loading