diff --git a/index.bs b/index.bs index 4b54fab..12955b0 100644 --- a/index.bs +++ b/index.bs @@ -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}}. A {{MediaStreamTrackProcessor}} makes frames available to its associated {{ReadableStream}} only when a read request has been issued on @@ -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; @@ -157,7 +160,10 @@ application that have not yet been handled.
`[[isClosed]]`
An boolean whose value indicates if the {{MediaStreamTrackProcessor}} is closed. -
+
`[[numDiscardedFrames]]`
+
The number of frames discarded by this {{MediaStreamTrackProcessor}}.
+
`[[numTotalFrames]]`
+
The number of frames received by this {{MediaStreamTrackProcessor}} including discarded frames.
### Constructor ### {#constructor-processor} @@ -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} @@ -222,6 +230,13 @@ It is defined by running the following steps: 1. Set |processor|.`[[isClosed]]` to true. + +
discardedFrames
+
Returns the value of |processor|.`[[numDiscardedFrames]]`.
+ +
totalFrames
+
Returns the value of |processor|.`[[numTotalFrames]]`.
+ ### Handling interaction with the track ### {#processor-handling-interaction-with-track} @@ -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. +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, to prevent resource exhaustion or to improve performance in certain situations. +In this case, |processor|.`[[numDiscardedFrames]]` MUST be incremented accordingly.

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}}.

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