|
3179 | 3179 | readonly attribute unsigned long displayWidth; |
3180 | 3180 | readonly attribute unsigned long displayHeight; |
3181 | 3181 | readonly attribute unsigned long long? duration; // microseconds |
3182 | | - readonly attribute long long? timestamp; // microseconds |
| 3182 | + readonly attribute long long timestamp; // microseconds |
3183 | 3183 | readonly attribute VideoColorSpace colorSpace; |
3184 | 3184 |
|
3185 | 3185 | unsigned long allocationSize( |
|
3503 | 3503 | The {{VideoFrame/timestamp}} getter steps are to return |
3504 | 3504 | {{VideoFrame/[[timestamp]]}}. |
3505 | 3505 |
|
| 3506 | + NOTE: Authors are encouraged to provide a meaningful timestamp unless it is |
| 3507 | + implicitly provided by the {{CanvasImageSource}} at construction. |
| 3508 | + Interfaces that consume {{VideoFrame}}s can rely on this value for |
| 3509 | + timing decisions. For example, {{VideoEncoder}} can use |
| 3510 | + {{VideoFrame/timestamp}} values to guide rate control (see |
| 3511 | + {{VideoEncoderConfig/framerate}}). |
| 3512 | + |
3506 | 3513 | : <dfn attribute for=VideoFrame>duration</dfn> |
3507 | 3514 | :: The presentation duration, given in microseconds. The duration is copied |
3508 | 3515 | from the {{EncodedVideoChunk}} corresponding to this VideoFrame. |
|
3739 | 3746 | algorithm with |init|, |frame|, |defaultVisibleRect|, |
3740 | 3747 | |defaultDisplayWidth|, and |defaultDisplayHeight|. |
3741 | 3748 | 9. If {{VideoFrameInit/duration}} [=map/exists=] in |init|, assign it to |
3742 | | - |frame|.{{VideoFrame/duration}}. Otherwise, assign |
| 3749 | + |frame|'s {{VideoFrame/[[duration]]}}. Otherwise, assign |
3743 | 3750 | |otherFrame|.{{VideoFrame/duration}} to |
3744 | | - |frame|.{{VideoFrame/duration}}. |
| 3751 | + |frame|'s {{VideoFrame/[[duration]]}}. |
3745 | 3752 | 10. If {{VideoFrameInit/timestamp}} [=map/exists=] in |init|, assign it to |
3746 | | - |frame|.{{VideoFrame/timestamp}}. Otherwise, assign |
3747 | | - |otherFrame|.{{VideoFrame/timestamp}} to |
3748 | | - |frame|.{{VideoFrame/timestamp}}. |
| 3753 | + |frame|'s {{VideoFrame/[[timestamp]]}}. Otherwise, assign |
| 3754 | + |otherFrame|'s {{VideoFrame/timestamp}} to |
| 3755 | + |frame|'s {{VideoFrame/[[timestamp]]}}. |
3749 | 3756 | 11. Assign |format| to |frame|.{{VideoFrame/[[format]]}}. |
3750 | 3757 |
|
3751 | 3758 | : <dfn for=VideoFrame>Initialize Frame With Resource and Size</dfn> (with |
|
3769 | 3776 | algorithm with |init|, |frame|, |defaultVisibleRect|, |width|, and |
3770 | 3777 | |height|. |
3771 | 3778 | 11. Assign `init`.{{VideoFrameInit/duration}} to |
3772 | | - |frame|.{{VideoFrame/duration}}. |
| 3779 | + |frame|'s {{VideoFrame/[[duration]]}}. |
3773 | 3780 | 12. Assign `init`.{{VideoFrameInit/timestamp}} to |
3774 | | - |frame|.{{VideoFrame/timestamp}}. |
| 3781 | + |frame|'s {{VideoFrame/[[timestamp]]}}. |
3775 | 3782 | 13. If |resource| has a known {{VideoColorSpace}}, assign its value to |
3776 | 3783 | {{VideoFrame/[[color space]]}}. |
3777 | 3784 | 14. Otherwise, assign a new {{VideoColorSpace}}, constructed with an empty |
|
4987 | 4994 | 11. Let |decodeResult| be a new {{ImageDecodeResult}} initialized as |
4988 | 4995 | follows: |
4989 | 4996 | 1. Assign 'true' to {{ImageDecodeResult/complete}}. |
4990 | | - 2. Let |timestamp| and |duration| be the presentation timestamp and |
4991 | | - duration for |output| as described by |encodedFrame|. If |
4992 | | - |encodedFrame| does not describe a timestamp or |
4993 | | - duration, assign `null` to the corresponding variable. |
4994 | | - 3. Assign {{ImageDecodeResult/image}} with the result of running the |
| 4997 | + 2. Let |duration| be the presentation duration for |output| as |
| 4998 | + described by |encodedFrame|. If |encodedFrame| does not have a |
| 4999 | + duration, assign `null` to |duration|. |
| 5000 | + 3. Let |timestamp| be the presentation timestamp for |output| as |
| 5001 | + described by |encodedFrame|. If |encodedFrame| does not have a |
| 5002 | + timestamp: |
| 5003 | + 1. If |encodedFrame| is a still image assign `0` to |timestamp|. |
| 5004 | + 2. If |encodedFrame| is a constant rate animated image and |
| 5005 | + |duration| is not `null`, assign `|frameIndex| * |duration|` to |
| 5006 | + |timestamp|. |
| 5007 | + 3. If a |timestamp| can otherwise be trivially generated from |
| 5008 | + metadata without further decoding, assign that to |timestamp|. |
| 5009 | + 4. Otherwise, assign `0` to |timestamp|. |
| 5010 | + 4. Assign {{ImageDecodeResult/image}} with the result of running the |
4995 | 5011 | [=Create a VideoFrame=] algorithm with |output|, |timestamp|, and |
4996 | 5012 | |duration|. |
4997 | 5013 | 12. Run the [=ImageDecoder/Resolve Decode=] algorithm with |promise| and |
|
5044 | 5060 | for |output|. |
5045 | 5061 | 3. Add a new entry to {{ImageDecoder/[[progressive frame |
5046 | 5062 | generations]]}} with key |frameIndex| and value |frameGeneration|. |
5047 | | - 15. Let |timestamp| and |duration| be the presentation timestamp and |
5048 | | - duration for |output| as described by |encodedFrame|. If |
5049 | | - |encodedFrame| does not describe a timestamp or |
5050 | | - duration, assign `null` to the corresponding variable. |
5051 | | - 16. Assign {{ImageDecodeResult/image}} with the result of running the |
5052 | | - [=Create a VideoFrame=] algorithm with |output|, |timestamp|, and |
5053 | | - |duration|. |
5054 | | - 17. Remove |promise| from {{ImageDecoder/[[pending decode promises]]}}. |
5055 | | - 18. Resolve |promise| with |decodeResult|. |
| 5063 | + 15. Let |duration| be the presentation duration for |output| as |
| 5064 | + described by |encodedFrame|. If |encodedFrame| does not describe a |
| 5065 | + duration, assign `null` to |duration|. |
| 5066 | + 16. Let |timestamp| be the presentation timestamp for |output| as |
| 5067 | + described by |encodedFrame|. If |encodedFrame| does not have a |
| 5068 | + timestamp: |
| 5069 | + 1. If |encodedFrame| is a still image assign `0` to |timestamp|. |
| 5070 | + 2. If |encodedFrame| is a constant rate animated image and |
| 5071 | + |duration| is not `null`, assign `|frameIndex| * |duration|` to |
| 5072 | + |timestamp|. |
| 5073 | + 3. If a |timestamp| can otherwise be trivially generated from |
| 5074 | + metadata without further decoding, assign that to |timestamp|. |
| 5075 | + 4. Otherwise, assign `0` to |timestamp|. |
| 5076 | + 17. Assign {{ImageDecodeResult/image}} with the result of running the |
| 5077 | + [=Create a VideoFrame=] algorithm with |output|, |timestamp|, and |
| 5078 | + |duration|. |
| 5079 | + 18. Remove |promise| from {{ImageDecoder/[[pending decode promises]]}}. |
| 5080 | + 19. Resolve |promise| with |decodeResult|. |
5056 | 5081 |
|
5057 | 5082 | : <dfn for=ImageDecoder>Resolve Decode</dfn> (with |promise| and |result|) |
5058 | 5083 | :: 1. [=Queue a task=] to perform these steps: |
|
5138 | 5163 | 6. Return `true`. |
5139 | 5164 |
|
5140 | 5165 | A <dfn>valid image MIME type</dfn> is a string that is a [=valid MIME type |
5141 | | -string=] and for which the `type`, per Section 3.1.1.1 of [[RFC9110]], is |
| 5166 | +string=] and for which the `type`, per Section 8.3.1 of [[RFC9110]], is |
5142 | 5167 | `image`. |
5143 | 5168 |
|
5144 | 5169 | : <dfn dict-member for=ImageDecoderInit>type</dfn> |
|
0 commit comments