-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathindex.bs
More file actions
2049 lines (1646 loc) · 110 KB
/
index.bs
File metadata and controls
2049 lines (1646 loc) · 110 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<pre class='metadata'>
Title: RTP Payload Format For AV1
Status: FD
Text Macro: SPECVERSION v1.0.0
URL: https://aomediacodec.github.io/av1-rtp-spec/v1.0.0.html
Shortname: av1-rtp
Editor: Michael Horowitz, Google
Editor: Danil Chapovalov, Google
Editor: Bernard Aboba, Microsoft
Editor: Alex Eleftheriadis, Vidyo
Editor: Stephen Botzko, Polycom
Abstract: This document describes an RTP payload format for the [[!AV1]] video codec. The payload format has wide applicability, from low bit-rate peer-to-peer usage, to high bit-rate multi-party video conferences. It includes provisions for temporal and spatial scalability.
Date: 2024-12-15
Repository: AOMediaCodec/av1-rtp-spec
Group: AOM
Markup Shorthands: css no
Boilerplate: omit conformance
</pre>
<style>
table {
border-collapse: collapse;
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 1rem;
background-color: transparent;
}
.table-bordered {
border: 1px solid #e9ecef;
}
.table-bordered thead td, .table-bordered thead th {
border-bottom-width: 2px;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #e9ecef;
}
.table-bordered td, .table-bordered th {
border: 1px solid #e9ecef;
}
.table-sm td, .table-sm th {
padding: .3rem;
}
.table td, .table th {
padding: .75rem;
vertical-align: top;
border-top: 1px solid #e9ecef;
}
table th {
background-color: #d6d8d9;
text-align: center;
}
.table-bordered td, .table-bordered th {
border: 1px solid #e9ecef;
}
.table-sm td, .table-sm th {
padding: .3rem;
}
</style>
<pre class=biblio>
{
"AV1": {
"href": "https://aomediacodec.github.io/av1-spec/av1-spec.pdf",
"title": "AV1 Bitstream & Decoding Process Specification",
"status": "Standard",
"publisher": "AOM"
},
"I-D.ietf-payload-vp9": {
"href": "https://tools.ietf.org/html/draft-ietf-payload-vp9",
"title": "RTP Payload Format for VP9 Video",
"publisher": "IETF",
"status": "Internet Draft (work in progress)"
},
"I-D.ietf-avtext-lrr": {
"href": "https://tools.ietf.org/html/draft-ietf-avtext-lrr-07",
"title": "The Layer Refresh Request (LRR) RTCP Feedback Message",
"publisher": "IETF",
"status": "Internet Draft (work in progress)"
}
}
</pre>
# Introduction # {#introduction}
This document describes an RTP payload specification applicable to the transmission of video streams encoded using the [[!AV1]] video codec. In AV1, the smallest individual video encoder entity presented for transport is the Open Bitstream Unit (OBU). This specification allows both for fragmentation and aggregation of OBUs in the same RTP packet, but explicitly disallows doing so across frame boundaries.
Appendix A of this document describes the Dependency Descriptor (DD) RTP Header extension, which conveys information about individual video frames and the dependencies between them. This allows forwarding of video frames in situations where an intermediary does not wish to examine the RTP payload or does not have access to it, such as when the RTP payload is encrypted end-to-end. While the DD RTP Header extension was designed for use with AV1, it may prove useful for other codecs as well.
This specification also provides several mechanisms through which scalability structures are described. AV1 uses the concept of predefined scalability structures. These are a set of commonly used picture prediction structures that can be referenced simply via an indicator value (scalability_mode_idc, residing in the sequence header). For cases that do not fall in any of the predefined cases, there is a mechanism for describing the scalability structure. These bitstream parameters greatly simplify the organization of the corresponding data at the RTP payload format level.
# Conventions, Definitions and Acronyms # {#definitions}
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[!RFC2119]].
: Coded frame
:: The representation of one frame before the decoding process.
: Frame
:: A frame in this document is synonymous to a Coded frame.
Note: In contrast, in AV1, Frame is defined as the representation of video signals in the spatial domain.
Note: Multiple frames may be present at the same instant in time.
: Media-Aware Network Element (MANE)
:: A middlebox that relays streams among transmitting and receiving clients by selectively forwarding packets and which may have access to the media [[RFC6184]].
: OBU element
:: An OBU, or a fragment of an OBU, contained in an RTP packet.
: Open Bitstream Unit (OBU)
:: The smallest bitstream data framing unit in AV1. All AV1 bitstream structures are packetized in OBUs.
: "S" Mode
:: A scalability mode in which multiple independent encodings are sent on the same SSRC. This includes the S2T1, S2T1h, S2T2, S2T2h, S2T3, S2T3h, S3T1, S3T1h, S3T2, S3T2h, S3T3 and S3T3h scalability modes defined in Section 6.7.5 of [[!AV1]].
: Selective Forwarding Middlebox (SFM)
:: A middlebox that relays streams among transmitting and receiving clients by selectively forwarding packets without accessing the media [[!RFC7667]].
: Temporal unit
:: Defined by the AV1 specification: A temporal unit consists of all the OBUs that are associated with a specific, distinct time instant.
# Media Format Description # {#format-description}
The AV1 codec can maintain up to eight reference frames, of which up to seven can be referenced by any new frame. AV1 also allows a frame to use another frame of a different spatial resolution as a reference frame. This allows internal resolution changes without requiring the use of key frames. These features together enable an AV1 encoder to implement various forms of coarse-grained scalability, including temporal, spatial, and quality scalability modes, as well as combinations of these, without the need for explicit scalable coding tools.
Spatial and quality layers define different and possibly dependent representations of a single input frame. For a given spatial layer, temporal layers define different frame rates of video. Spatial layers allow a frame to be encoded at different spatial resolutions, whereas quality layers allow a frame to be encoded at the same spatial resolution but at different qualities (and thus with different amounts of coding error). AV1 supports quality layers as spatial layers without any resolution changes; hereinafter, the term "spatial layer" is used to represent both spatial and quality layers.
This payload format specification provides for specific mechanisms through which such temporal and spatial scalability layers can be described and communicated.
Temporal and spatial scalability layers are associated with non-negative integer IDs. The lowest layer of either type has an ID equal to 0.
Note: Layer dependencies are constrained by the AV1 specification such that a temporal layer with temporal_id T and spatial layer with spatial_id S are only allowed to reference previously coded video data having temporal_id T' and spatial_id S', where T' <= T and S' <= S.
# Payload Format # {#payload-format}
This section describes how the encoded AV1 bitstream is encapsulated in RTP.
## RTP Header Usage ## {#rtp-header-usage}
The general RTP payload format follows the RTP header format [[!RFC3550]] and generic RTP header extensions [[!RFC8285]], and is shown below.
The Dependency Descriptor and AV1 aggregation header are described in this document. The payload itself is a series of OBU elements, preceded by length information as detailed later in this document. An OBU element is either an entire OBU or an OBU fragment.
<pre><code>
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| synchronization source (SSRC) identifier |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| contributing source (CSRC) identifiers |
| .... |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| 0x100 | 0x0 | extensions length |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| ID | hdr_length | |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
| |
| dependency descriptor (hdr_length #bytes) |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Other rtp header extensions...|
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| AV1 aggr hdr | |
+-+-+-+-+-+-+-+-+ |
| |
| Bytes 2..N of AV1 payload |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| : OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</code></pre>
Note: The ID used to identify the Dependency Descriptor is signaled as defined in Section A.7 of this specification. Some examples are provided in Sections 7.2 and 7.3.
## RTP Header Marker Bit (M) ## {#rtp-header-marker}
The RTP header Marker bit MUST be set equal to 0 if the packet is not the last packet of the temporal unit, it SHOULD be set equal to 1 otherwise.
Note: It is possible for a receiver to receive the last packet of a temporal unit without the marker bit being set equal to 1, and a receiver should be able to handle this case. The last packet of a temporal unit is also indicated by the next packet, in RTP sequence number order, having an incremented timestamp.
## Dependency Descriptor RTP Header Extension ## {#dependency-descriptor}
To facilitate the work of selectively forwarding portions of a scalable video bitstream, as is done by a Selective Forwarding Middlebox (SFM), certain information needs to be provided for each packet. Appendix A of this specification defines how this information is communicated.
## AV1 Aggregation Header ## {#aggregation-header}
The aggregation header is carried in the first byte of the RTP payload and is used to indicate if the first and/or last OBU element in the payload is a fragment of an OBU. The aggregation header is not part of the AV1 bitstream and MUST NOT be presented to an AV1 decoder.
The structure is as follows.
<pre><code>
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|Z|Y| W |N|-|-|-|
+-+-+-+-+-+-+-+-+
</code></pre>
Z: MUST be set to 1 if the first OBU element is an OBU fragment that is a continuation of an OBU fragment from the previous packet, and MUST be set to 0 otherwise.
Y: MUST be set to 1 if the last OBU element is an OBU fragment that will continue in the next packet, and MUST be set to 0 otherwise.
W: two bit field that describes the number of OBU elements in the packet. This field MUST be set equal to 0 or equal to the number of OBU elements contained in the packet. If set to 0, each OBU element MUST be preceded by a length field. If not set to 0 (i.e., W = 1, 2 or 3) the last OBU element MUST NOT be preceded by a length field. Instead, the length of the last OBU element contained in the packet can be calculated as follows:
<pre><code>
Length of the last OBU element =
length of the RTP payload
- length of aggregation header
- length of previous OBU elements including length fields
</code></pre>
N: MUST be set to 1 if the packet is the first packet of a coded video sequence, and MUST be set to 0 otherwise.
Note: if N equals 1 then Z must equal 0.
## Payload Structure ## {#rtp-payload}
The smallest high-level syntax unit in AV1 is the OBU. All AV1 bitstream structures are packetized in OBUs. Each OBU has a header, which provides identifying information for the contained data (payload).
The payload contains a series of one or more OBU elements. The design allows for a combination of aggregation and fragmentation of OBUs, i.e., a set of OBU elements in which the first and/or last element is a fragment of an OBU.
The length field is encoded using leb128. Leb128 is defined in the AV1 specification, and provides for a variable-sized, byte-oriented encoding of non-negative integers where the first bit of each (little-endian) byte indicates whether or not additional bytes are used in the representation (AV1, Section 4.10.5).
Whether or not the first and/or last OBU element is a fragment of an OBU is signaled in the aggregation header. Fragmentation may occur regardless of how the W field is set.
The AV1 specification allows OBUs to have an optional size field called obu_size (also leb128 encoded), signaled by the obu_has_size_field flag in the OBU header. To minimize overhead, the obu_has_size_field flag SHOULD be set to zero in all OBUs.
The following figure shows an example payload where the length field is shown as taking two bytes for the first and second OBU elements and one byte for the last (N) OBU element.
<pre><code>
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Z|Y|0 0|N|-|-|-| OBU element 1 size (leb128) | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
: :
: OBU element 1 data :
: :
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | OBU element 2 size (leb128) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: :
: OBU element 2 data :
: :
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: :
: ... :
: :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|OBU e... N size| |
+-+-+-+-+-+-+-+-+ OBU element N data +-+-+-+-+-+-+-+-+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</code></pre>
The following figure shows an example payload containing two OBU elements where the last OBU element omits the length field (and the W field is set to 2). The size of the last OBU element can be calculated given the formula described in Section 4.4.
<pre><code>
OBU element example size calculation:
Total RTP payload size = 303 bytes
AV1 aggregation header = 1 byte
OBU element 1 size = 2 bytes
OBU element 1 data = 200 bytes
OBU element 2 data = 303 - 1 - (2 + 200) = 100 bytes
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Z|Y|1 0|N|-|-|-| OBU element 1 size (leb128) | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
: :
: OBU element 1 data :
: :
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
: :
: OBU element 2 data :
: :
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</code></pre>
# Packetization Rules # {#packetization}
Each RTP packet MUST NOT contain OBUs that belong to different temporal units.
The temporal delimiter OBU, if present, SHOULD be removed when transmitting, and MUST be ignored by receivers. Tile list OBUs are not supported. They SHOULD be removed when transmitted, and MUST be ignored by receivers.
If a sequence header OBU is present in an RTP packet and operating_points_cnt_minus_1 > 0 then for any number i where 0 <= i < operating_points_cnt_minus_1 the following MUST be true: (operating_point_idc[i] & operating_point_idc[i+1]) == operating_point_idc[i+1].
A sender MAY produce a sequence header with operating_points_cnt_minus_1 = 0 and operating_point_idc[0] = 0xFFF and seq_level_idx[0] = 0. In such case, seq_level_idx[0] does not reflect the level of the operating point.
Note: The intent is to disable OBU dropping in the AV1 decoder. To ensure a decoder’s capabilities are not exceeded, OBU filtering should instead be implemented at the system level (e.g., in a MANE).
If more than one OBU contained in an RTP packet has an OBU extension header, then the values of the temporal_id and spatial_id MUST be the same in all such OBUs in the RTP packet.
If a sequence header OBU is present in an RTP packet, then it SHOULD be the first OBU in the packet. OBUs that are not associated with a particular layer (and thus do not have an OBU extension header) SHOULD be in the beginning of a packet, following the sequence header OBU if present.
A sequence header OBU SHOULD be aggregated with the base layer when scalable encoding is used. When simulcast encodings are transported on the same SSRC (an "S" mode), a sequence header OBU SHOULD be aggregated with each spatial layer. This ensures that if an intermediary removes simulcast encodings from the bitstream before forwarding, the modified bitstream will still be decodable.
## Examples ## {#packetization-examples}
The following are example packetizations of OBU sequences. A two-letter notation is used to identify the OBU type: FH - frame header, TG - tile group, FR - frame, SH - sequence header, TD - temporal delimitered, MD - metadata. Parentheses after the type indicate the temporal_id and spatial_id combination. For example "TG(0,1)" indicates a tile group OBU with temporal_id equal to 0 and spatial_id equal to 1.
The following is an example coded video sequence:
<pre><code>
TD SH MD MD(0,0) FH(0,0) TG(0,0) MD(0,1) FH(0,1) TG(0,1) ...
</code></pre>
This sequence could be packetized as follows. First, the TD OBU is dropped. Then, the following packetization grouping (indicated using square brackets) may be used:
<pre><code>
[ SH MD MD(0,0) FH(0,0) TG(0,0) ] [ MD(0,1) FH(0,1) TG(0,1) ]
</code></pre>
It is also possible to send each OBU in its own RTP packet:
<pre><code>
[ SH ] [ MD ] [ MD(0,0) ] [ FH(0,0) ] [ TG(0,0) ] ...
</code></pre>
The following packetization grouping would not be allowed, since it combines data from different spatial layers in the same packet:
<pre><code>
[ SH MD MD(0,0) FH(0,0) TG(0,0) MD(0,1) FH(0,1) TG(0,1) ]
</code></pre>
# MANE and SFM Behavior # {#mane}
If a packet contains an OBU with an OBU extension header then the entire packet is considered associated with the layer identified by the temporal_id and spatial_id combination that are indicated in the extension header. If a packet does not contain any OBU with an OBU extension header, then it is considered to be associated with all operating points.
The general function of a MANE or SFM is to selectively forward packets to receivers. To make forwarding decisions a MANE may inspect the media payload, so that it may need to be able to parse the AV1 bitstream and if so, cannot function when end-to-end encryption is enabled. An SFM does not parse the AV1 bitstream and therefore needs to obtain the information relevant to selective forwarding by other means, such as the Dependency Descriptor described in Appendix A. In addition to enabling bitstream-independent forwarding and support for end-to-end encryption, the Dependency Descriptor also enables forwarding where the metadata OBU provided in the AV1 bitstream is not sufficient to express the structure of the stream.
## Simulcast ## {#simulcast}
The RTP payload defined in this specification supports two distinct modes for transport of simulcast encodings. In either mode, simulcast transport MUST only be used to convey multiple encodings from the same source. Also, in either mode, a sequence header OBU SHOULD be aggregated with each spatial layer.
When simulcast encodings are transported each on a separate RTP stream, each simulcast encoding utilizes a distinct bitstream containing its own distinct Sequence Header and Scalability Metadata OBUs. This mode utilizes distinct SSRCs and Restriction Identifiers (RIDs) for each encoding as described in [[!RFC8852]] and, as a result, RTCP feedback can be provided for each simulcast encoding. This mode of simulcast transport utilizes Session Description Protocol (SDP) signaling as described in [[!RFC8851]] and [[!RFC8853]].
When simulcast encodings are transported on a single RTP stream, RIDs are not used and the Sequence Header and Scalability Metadata OBUs (utilizing an 'S' mode) convey information relating to all encodings. This simulcast transport mode is possible since AV1 enables multiple simulcast encodings to be provided within a single bitstream. However, in this mode, RTCP feedback cannot be provided for each simulcast encoding, but only for the aggregate, since only a single SSRC is used.
### Example ### {#simulcast-example}
In this example, it is desired to send three simulcast encodings, each containing three temporal layers. When sending all encodings on a single SSRC, scalability mode 'S3T3' would be indicated within the scalability metadata OBU, and the Dependency Descriptor describes the dependency structure of all encodings.
When sending each simulcast encoding on a distinct SSRC, the scalability mode 'L1T3' would be indicated within the scalability metadata OBU of each bitstream, and the Dependency Descriptor in each stream describes only the dependency structure for that individual encoding. A distinct spatial_id (e.g. 0, 1, 2) could be used for each stream (if a single AV1 encoder is used to produce the three simulcast encodings), but if distinct AV1 encoders are used, the spatial_id values may not be distinct.
## Constraints For Scalable Video Bitstreams ## {#scalable-constraints}
The following AV1 bitstream constraints need to be applied when transmitting scalable video bitstreams, in order to ensure correct packet forwarding behavior by a MANE.
The obu_extension_flag MUST be equal to 0 in any sequence header OBU. This ensures that sequence headers will be forwarded to all receivers.
Note: this constraint is required despite the ambiguity of the text that defines operating_point_idc[i] in Section 6.4.1 of [[AV1]].
The obu_extension_flag MUST be equal to 1 in all frame, frame header, redundant frame header, and tile group OBUs. This enables the MANE to only forward these OBUs to receivers using operating points that require them.
The obu_extension_flag MUST be equal to 0 in a scalability metadata OBU. This ensures that the scalability metadata will be forwarded to all receivers.
The obu_extension_flag MAY be equal to 1 in a padding OBU.
# Payload Format Parameters # {#payload-params}
This section specifies the parameters that MAY be used to select optional features of the payload format and certain features of the bitstream.
## Media Type Definition ## {#media-type}
The AV1 media type used for signaling the transfer of AV1 via RTP is registered at <a href="https://www.iana.org/assignments/media-types/video/AV1">https://www.iana.org/assignments/media-types/video/AV1</a>.
## SDP Parameters ## {#sdp-parameters}
The parameters for AV1 are <b>profile</b>, <b>level-idx</b>, and <b>tier</b> These parameters indicate the profile, level, and tier of the bitstream carried by the RTP stream, or a specific set of the profile, level, and tier that the receiver supports.
The <b>profile</b> parameter is an integer indicating the highest AV1 profile that may have been used to generate the bitstream or that the receiver supports. The range of possible values is identical to the <b>seq_profile</b> syntax element specified in [[!AV1]]. If the parameter is not present, it MUST be inferred to be 0 (“Main” profile).
The <b>level-idx</b> parameter is an integer indicating the highest AV1 level that may have been used to generate the bitstream or that the receiver supports. The range of possible values is identical to the <b>seq_level_idx</b> syntax element specified in [[!AV1]]. If the parameter is not present, it MUST be inferred to be 5 (level 3.1).
The <b>tier</b> parameter is an integer indicating the highest tier that may have been used to generate the bitstream or that the receiver supports. The range of possible values is identical to the <b>seq_tier</b> syntax element specified in [[!AV1]]. If the parameter is not present, it MUST be inferred to be 0.
### Mapping of Media Subtype Parameters to SDP ### {#sdp-mapping-media-subtype}
The media type video/AV1 string is mapped to fields in the Session Description Protocol (SDP) per [[RFC4566 obsolete]] as follows:
* The media name in the "m=" line of SDP MUST be video.
* The encoding name in the "a=rtpmap" line of SDP MUST be AV1 (the media subtype).
* The clock rate in the "a=rtpmap" line MUST be 90000.
* The parameters "<b>profile</b>", "<b>level-idx</b>", and "<b>tier</b>" MAY be included in the "a=fmtp" line of SDP. These parameters are expressed as a media subtype string, in the form of a semicolon separated list of parameter=value pairs.
The receiver MUST ignore any fmtp parameter not specified in this document.
### RID Restrictions Mapping for AV1 ### {#rid}
The RID specification declares the set of codec-agnostic restrictions for media streams. All the restrictions are optional and are subject to negotiation based on the SDP Offer/Answer rules described in Section 6 in [[!RFC8851]]. When these restrictions are applied to the AV1 codec, they MUST have the following interpretation:
* <b>max-width</b>, maximum width of the frame in units of samples. The meaning of the restriction is the same as variable <b>MaxHSize</b> of the levels table from Section A.3 of [[!AV1]].
* <b>max-height</b>, maximum height of the frame in units of samples. The meaning of the restriction is the same as variable <b>MaxVSize</b> of the levels table from Section A.3 of [[!AV1]].
* <b>max-fps</b>, maximum number of temporal units per second.
* <b>max-fs</b>, maximum size of the frame in units of samples. The meaning of the restriction is the same as variable <b>MaxPicSize</b> of the levels table from Section A.3 of [[!AV1]].
* <b>max-br</b>, maximum bit rate in units bits per second. The meaning of the restriction is the same as variable <b>MaxBitrate</b> defined in Section A.3 of [[!AV1]].
* <b>max-pps</b>, maximum decode rate in units of samples per second. The meaning of the restriction is the same as variable <b>MaxDecodeRate</b> of the levels table from Section A.3 of [[!AV1]].
* <b>max-bpp</b>, maximum number of bits per pixel of any given coded frame, calculated as a ratio between <b>CompressedSize</b> variable defined Section A.3 of [[!AV1]] and expressed in bits, and number of samples in frame.
If during the SDP negotiation process both parties acknowledge restrictions, then the transported media stream MUST have at least one operating point with the negotiated restrictions.
### Usage with the SDP Offer/Answer Model ### {#sdp-offer-answer}
When AV1 is offered over RTP using SDP in an Offer/Answer model as described in [[RFC3264]] for negotiation for unicast usage, the following limitations and rules apply:
* The media format configuration is identified by <b>level-idx</b>, <b>profile</b> and <b>tier</b>. These media configuration parameters are asymmetrical and the answerer MAY declare its own media configuration if the answerer receiving capabilities are different from the offerer.
* The AV1 stream sent by either the offerer or the answerer MUST be encoded with a profile, level and tier, lesser or equal to the values of the <b>level-idx</b>, <b>profile</b> and <b>tier</b> declared in the SDP by the receiving agent.
### Usage in Declarative Session Descriptions ### {#declarative-session}
When AV1 over RTP is offered with SDP in a declarative style, as in Real Time Streaming Protocol (RTSP) [[RFC2326 obsolete]] or Session Announcement Protocol (SAP) [[RFC2974]], the following considerations apply.
* All parameters capable of indicating both stream properties and receiver capabilities are used to indicate only stream properties. In this case, the parameters <b>profile</b>, <b>level-idx</b> and <b>tier</b> declare only the values used by the stream, not the capabilities for receiving streams.
* A receiver of the SDP is required to support all parameters and values of the parameters provided; otherwise, the receiver MUST reject (RTSP) or not participate in (SAP) the session. It falls on the creator of the session to use values that are expected to be supported by the receiving application.
## Examples ## {#parameter-examples}
An example of media representation in SDP is as follows:
* m=video 49170 RTP/AVPF 98
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
### Level upgrading ### {#sdp-level-upgrading}
In the following example the offer is accepted with level upgrading. The level to use in the offerer-to-answerer direction is Level 2.0, and the level to use in the answerer-to-offerer direction is Level 3.0/Tier 1. The answerer is allowed to send at any level up to and including Level 2.0, and the offerer is allowed to send at any level up to and including Level 3.0/Tier 1:
Offer SDP:
* m=video 49170 RTP/AVPF 98
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=0; level-idx=0;
Answer SDP:
* m=video 49170 RTP/AVPF 98
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=0; level-idx=4; tier=1;
### Simulcast with Payload Multiplexing ### {#sdp-simulcast-payload-mux}
In the following example an offer is made by a conferencing server to receive 3 simulcast streams with payload multiplexing. The answerer agrees to send 3 simulcast streams at different resolutions.
Offer SDP:
* m=video 49170 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=rtpmap:99 AV1/90000
* a=rtpmap:100 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=fmtp:99 profile=2; level-idx=8; tier=1;
* a=fmtp:100 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
* a=rtcp-fb:99 ccm fir
* a=rtcp-fb:99 nack
* a=rtcp-fb:99 nack pli
* a=rtcp-fb:100 ccm fir
* a=rtcp-fb:100 nack
* a=rtcp-fb:100 nack pli
* a=rid:q recv pt=98;max-width=640;max-height=480
* a=rid:h recv pt=99;max-width=1280;max-height=720
* a=rid:f recv pt=100;max-width=1920;max-height=1080
* a=simulcast:recv q;h;f
Answer SDP:
* m=video 48120 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=fmtp:99 profile=2; level-idx=8; tier=1;
* a=fmtp:100 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
* a=rtcp-fb:99 ccm fir
* a=rtcp-fb:99 nack
* a=rtcp-fb:99 nack pli
* a=rtcp-fb:100 ccm fir
* a=rtcp-fb:100 nack
* a=rtcp-fb:100 nack pli
* a=rid:q send pt=98;max-width=640;max-height=480
* a=rid:h send pt=99;max-width=1280;max-height=720
* a=rid:f send pt=100;max-width=1920;max-height=1080
* a=simulcast:send q;h;f
### Simulcast with SSRC Multiplexing ### {#sdp-simulcast-ssrc}
In the following example an offer is made by a conferencing server to receive 3 simulcast streams with SSRC multiplexing. The answerer agrees to send 3 simulcast streams at different resolutions.
Offer SDP:
* m=video 49170 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
* a=rid:q recv
* a=rid:h recv
* a=rid:f recv
* a=simulcast:recv q;h;f
Answer SDP:
* m=video 48120 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
* a=rid:q send
* a=rid:h send
* a=rid:f send
* a=simulcast:send q;h;f
### Single Stream Simulcast ### {#sdp-single-stream-simulcast}
In the following example an offer is made to send a single RTP stream to a conferencing server. This single stream might include any AV1 dependency structure, including "S" scalability modes.
Offer SDP:
* m=video 49170 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
Answer SDP:
* m=video 48120 UDP/TLS/RTP/SAVPF 98
* a=mid:0
* a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
* a=extmap:3 urn:3gpp:video-orientation
* a=extmap:4 https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension
* a=sendrecv
* a=rtcp-mux
* a=rtcp-rsize
* a=rtpmap:98 AV1/90000
* a=fmtp:98 profile=2; level-idx=8; tier=1;
* a=rtcp-fb:98 ccm fir
* a=rtcp-fb:98 nack
* a=rtcp-fb:98 nack pli
# Feedback Messages # {#feedback}
## Full Intra Request (FIR) ## {#fir}
The Full Intra Request (FIR) RTCP feedback message defined in [[!RFC5104]] allows a
receiver to request a Decoder Refresh Point of an encoded stream.
Section 3 of [[RFC8082]] updates the definition of the Decoder Refresh
Point.
Upon reception of an FIR, for every SSRC indicated in the FIR message,
the AV1 sender MUST send a new coded video sequence as soon as possible.
See section 7.5 of the [[!AV1]] video codec for the definition
of a new coded video sequence.
If simulcast encodings of the same source are transported on distinct SSRCs,
then in addition to sending a new coded video sequence for each encoding
corresponding to an SSRC in the FIR message, the AV1 sender MAY also send
new coded video sequences for other encodings from the same source(s).
## Layer Refresh Request (LRR) ## {#lrr}
The Layer Refresh Request specified in [[!I-D.ietf-avtext-lrr]] is designed to allow a receiver of a layered media stream to request that one or more of its substreams be refreshed, such that it can then be decoded by an endpoint which previously was not receiving those layers, without requiring that the entire stream be refreshed (as it would be if the receiver sent a Full Intra Request (FIR) per [[!RFC5104]]).
<pre><code>
+---------------+---------------+
|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+---------------+---------+-+---+
| RES | TID | RES |0|SID|
+---------------+---------+-+---+
</code></pre>
AV1 streams MUST use the Layer Refresh Request format defined for VP9 in Section 5.3 of [[!I-D.ietf-payload-vp9]], with the high order bit of its three-bit SID field set to 0. The figure above shows the format for AV1 streams. Notice that SID here is two bits. SID is associated with AV1's spatial_id and TID is associated with AV1's temporal_id. See Sections 2, 5.3.3, and 6.2.3 of the AV1 bitstream specification [[!AV1]] for details on the temporal_id and spatial_id fields.
Identification of a layer refresh frame may be performed by examining the coding dependency structure of the coded video sequence it belongs to. This may be provided by the scalability metadata (Sections 5.8.5 and 6.7.5 of [[!AV1]]), either in the form of a pre-defined scalability mode or through a scalability structure (Sections 5.8.6 and 6.7.6 of [[!AV1]]). Alternatively, the Dependency Descriptor RTP header extension that is specified in Appendix A of this document may be used.
# IANA Considerations # {#iana}
The AV1 media type is registered with IANA for signaling the transfer of AV1 via RTP at <a href="https://www.iana.org/assignments/media-types/video/AV1">https://www.iana.org/assignments/media-types/video/AV1</a>.
# Security Considerations # {#security}
RTP packets using the payload format defined in this document are subject to the security considerations discussed in the RTP specification [[!RFC3550]] and in any appropriate RTP profile. This implies that confidentiality of the media streams is achieved by encryption, for example, through the application of SRTP [[RFC3711]]. A potential denial-of-service threat exists for data encodings using compression techniques that have non-uniform receiver-end computational load. The attacker can inject pathological datagrams into the stream that are complex to decode and that cause the receiver to be overloaded. Therefore, the usage of data origin authentication and data integrity protection of at least the RTP packet is RECOMMENDED, for example, with SRTP [[RFC3711]]. Encryption of RTP Header Extensions such as the Dependency Descriptor is also RECOMMENDED, using techniques such as [[!RFC6904]] or successor specifications.
Note that the appropriate mechanism to ensure confidentiality and integrity of RTP packets and their payloads is very dependent on the application and on the transport and signaling protocols employed. Thus, although SRTP is given as an example above, other possible choices exist. See [[RFC7202]].
Decoders MUST discard reserved OBU types and reserved metadata OBU types, and SHOULD filter out temporal delimiter and tile list OBUs carried within the RTP payload. Middle boxes SHOULD NOT parse OBUs they do not support.
End-to-end security services such as authentication, integrity, or confidentiality protection could prevent an SFM or MANE from performing media-aware operations other than discarding complete packets. For example, repacketization requires that the MANE have access to the cleartext media payload. The Dependency Descriptor RTP extension described in Appendix A allows discarding of packets in a media-aware way even when confidentiality protection is used.
# Acknowledgements # {#acknowledgements}
Bernard Aboba made valuable contributions to this document, and to the AV1 Specification. Bernard passed away in February 2025. This document is dedicated to his memory, as a small token of appreciation of his many contributions.
# Appendix A - Dependency Descriptor RTP Header Extension # {#dependency-descriptor-rtp-header-extension}
## A.1 Introduction ## {#a1-intro}
This appendix describes the Dependency Descriptor (DD) RTP Header extension. The DD is used for conveying dependency information about individual video frames in a scalable video stream. The DD includes provisions for both temporal and spatial scalability.
In the DD, the smallest unit for which dependencies are described is an RTP frame. An RTP frame contains one complete coded video frame and may also contain additional information (e.g., metadata). Each RTP frame is identified by a frame_number. When spatial scalability is used, there may be multiple RTP frames produced for the same time instant. Further, this specification allows for the transmission of an RTP frame over multiple packets. RTP frame aggregation is explicitly disallowed. Hereinafter, RTP frame will be referred to as frame.
The DD uses the concept of Decode targets, each of which represents a subset of a scalable video stream necessary to decode the stream at a certain temporal and spatial fidelity. A frame may be associated with several Decode targets. This concept is used to facilitate selective forwarding, as is done by a Selective Forwarding Middlebox (SFM). Typically an SFM would select one Decode target for each endpoint, and forward all frames associated with that target.
The DD also uses the concept of Instantaneous Decidability or Decodability (IDD). The IDD property is the ability to decide immediately whether a received or missed packet is needed to decode a received bitstream. This property allows an SFM to determine whether it has to forward a packet to one or more downstream endpoints or attempt to recover essential missed packets.
The property is satisfied when the receiver is able to determine whether:
* The packet belongs to a frame which is required for the endpoint's Decode target. This is determined from the Decode Target Indication (DTI) values (see Section A.4).
* All frames referenced by the current frame have been forwarded to the endpoint. This is determined from the frame difference values (see Section A.8.3).
* Upon receiving the very first packet after an RTP sequence number gap, if any of the missed packets are required for the Decode target to remain decodable. This is determined from the Chain information (see Section A.6).
To reduce overhead, the DD uses templates to avoid sending repetitive information. Subsequent packets refer to a template containing predefined information, which may be overridden with custom dependencies. In this way, the typical DD payload requires three bytes. Dynamic structures whose information is not known in advance can be described using additional bytes.
## A.2 Conventions, Definitions and Acronyms ## {#a2-definitions}
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[RFC2119]].
: Chain
:: A sequence of frames for which it can be determined instantly if a frame from that sequence has been lost.
: Decode target
:: The set of frames needed to decode a coded video sequence at a given spatial and temporal fidelity.
: Decode Target Indication (DTI)
:: Describes the relationship of a frame to a Decode target. The DTI indicates four distinct relationships: 'not present', 'discardable', 'switch', and 'required'.
: Discardable indication
:: An indication for a frame, associated with a given Decode target, that it will not be a Referred frame for any frame belonging to that Decode target.
Note: A frame belonging to more than one Decode target may be discardable for one Decode target and not for another.
: Frame dependency structure
:: Describes frame dependency information for the coded video sequence. The structure includes the number of DTIs, an ordered list of Frame dependency templates, and a mapping between Chains and Decode targets.
: Frame dependency template
:: Contains frame description information that many frames have in common. Includes values for spatial ID, temporal ID, DTIs, frame dependencies, and Chain information.
: Not present indication
:: An indication for a frame, that it is not associated with a given Decode target.
: Referred frame
:: A frame on which the current frame depends.
: Required indication
:: An indication for a frame, associated with a given Decode target, that it belongs to the Decode target and has neither a Discardable indication nor a Switch indication.
Note: A frame belonging to more than one Decode target may be required for one Decode target and not required (either discardable or switch) for another.
: Switch indication
:: An indication associated with a specific Decode target that all subsequent frames for that Decode target will be decodable if the frame containing the indication is decodable.
## A.3 Media Stream Requirements ## {#a3-requirements}
A bitstream conformant to this extension must adhere to the following statement(s).
A frame for which all Referred frames are decodable MUST itself be decodable.
Note: dependencies are not limited to motion compensated prediction, other relevant information such as entropy decoder state also constitute dependencies.
## A.4 Active Decode Targets ## {#a4-decode-targets}
When an SFM changes the set of forwarded Decode targets or an encoder changes the set of produced Decode targets, some Decode targets may become unavailable for decoding. Whenever the set of active Decode targets changes, the sender MUST signal the new set of active Decode targets to the receiver.
Active Decode targets are signaled either explicitly, when active_decode_targets_present_flag is equal to 1, or implicitly, when template_dependency_structure_present_flag is equal to 1 and active_decode_targets_present_flag is equal to 0, in which case all Decode targets are active.
When an update to the set of active decode targets is received it is valid until the next update in RTP packet sequence number order.
The sender SHOULD signal updates in such a way that a receiver, even after packet loss, will immediately either know the new set of active Decode targets or if the set of active Decode targets is lost, ensure that at least one Chain will break.
<div class="note">
<strong>Note:</strong> The following example techniques may be used to signal a set of active Decode targets:
<ul>
<li>Send a new keyframe when the set of active Decode targets has been updated.</li>
<li>Send the active_decode_targets_bitmask in every packet.</li>
<li>Send the active_decode_targets_bitmask in every packet until one of those packets has been acknowledged by a receiver report.</li>
</ul>
</div>
## A.5 Chains ## {#a5-chains}
A Chain defines a sequence of frames essential to decode Decode targets protected by that Chain. Every packet includes, for every Chain, the frame_number of the previous frame in that Chain. The Chain is intact as long as every frame in the Chain is received, otherwise it is broken. A decodable frame with frame_chain_fdiff equal to 0 indicates that the Chain is intact.
Note: The concept of Chains is a generalization of the TL0PICIDX field used in the RTP payload formats for scalable codecs such as VP8 and VP9.
A sender MUST construct Chains such that a receiver having received all frames in the Chain, and having missed one or more frames not in the Chain, need not request additional information (e.g., NACK or FIR) from the sender in order to resume decoding at full fidelity of the Decode target protected by the Chain.
Note: Not decoding a frame associated with a Decode target that is also not present in the Chain will result in a temporary reduction of fidelity. A frame that is not present in the Chain may be dropped even if the Decode Target Indication for that frame is not Discardable.
The Frame dependency structure includes a mapping between Decode targets and Chains. The mapping gives an SFM the ability to determine the set of Chains it needs to track in order to ensure that the corresponding Decode targets remain decodable. Chains protecting no active Decode targets MUST be ignored.
Note: To increase the chance of using a predefined template, chains protecting no active Decode targets may refer to any frame, including an RTP frame that was never produced.
## A.6 Usage of Chains After Packet Loss ## {#a6-chains}
Chains provide the ability to decide immediately upon receiving the very first packet after packet loss, if any of the lost packets are required for the Decode target to remain decodable.
Due to the fact that the Chain information is present in all packets, an SFM can detect a broken Chain regardless of whether the first packet received after a loss is part of that Chain or not.
In the event of packet loss within the frame that is currently being received, it may be helpful to determine if that frame is part of the Chain by using the following example function.
<pre><code>
PartOfActiveChain(chainIdx) {
if (!ChainHasActiveDecodeTarget(chainIdx)) {
return false
}
for (i = 0; i < DtCnt; ++i) {
if (decode_target_protected_by[i] != chainIdx) {
continue
}
if (frame_dti[i] == 0 || frame_dti[i] == 1) {
return false
}
}
return true
}
</code></pre>
<pre><code>
ChainHasActiveDecodeTarget(chainIdx) {
for (i = 0; i < DtCnt; ++i) {
if (decode_target_protected_by[i] != chainIdx) {
continue
}
if ((active_decode_targets_bitmask >> i) & 1) {
return true
}
}
return false
}
</code></pre>
Note: The variables <code>DtCnt</code>, <code>decode_target_protected_by</code>, <code>frame_dti</code> and <code>active_decode_targets_bitmask</code> used in the example above are read or derived from the dependency descriptor as described in Section A.8.
## A.7 Switching ## {#a7-switching}
An SFM MAY begin forwarding packets belonging to a new Decode target beginning with a decodable frame containing a Switch indication to that Decode target.
When Chains are used, an SFM MAY switch to a Decode target at any point if the Chain tracking that Decode target is intact.
Note: Every Decode target is associated with a spatial and temporal layer, which the SFM may use to select which Decode target to forward.
## A.8 Dependency Descriptor Format ## {#a8-dependency}
To facilitate the work of selectively forwarding portions of a scalable video bitstream, as is done by an SFM, for each packet, the following information is made available (even though not all elements are present in every packet).
* spatial ID
* temporal ID
* DTIs
* frame_number of the current frame
* frame_number of each of the Referred frames
* frame_number of last frame in each Chain
### A.8.1 Templates ### {#a81-templates}
To reduce overhead, repetitive information can be predefined with templates and sent once. Subsequent packets refer to a template containing predefined information. In particular, when a video encoder uses an unchanging (static) prediction structure to encode a scalable bitstream, parameter values used to describe the bitstream repeat in a predictable way. The techniques described in this document provide means to send repeating information as predefined templates that can be referenced at future points of the bitstream. Since a reference index to a template requires fewer bits to convey than the associated structures themselves, header overhead can be substantially reduced.
The techniques also provide ways to describe changing (dynamic) prediction structures. In cases where custom dependency information is required, parameter values are explicitly defined rather than referenced in a predefined template. Typically, even in dynamic structures the majority of frames still follow one of the predefined templates.
### A.8.2 Syntax ### {#a82-syntax}
The syntax for the descriptor is described in pseudo-code form in this section. Parameters read directly from the bitstream appear in bold.
<b>f(n)</b> - unsigned n-bit number appearing directly in the bitstream. The bits are read from high to low order.
<pre><code>
f(n) {
x = 0
for ( i = 0; i < n; i++ ) {
x = 2 * x + read_bit()
}
TotalConsumedBits += n
return x
}
</code></pre>
<pre><code>
read_bit() {
// Returns the next bit from the bitstream and advances the bitstream position indicator by 1.
}
</code></pre>
<b>ns(n)</b> - non-symmetric unsigned encoded integer with maximum number of values n (i.e., output in range 0..n-1).
This descriptor is similar to ceiling of the base 2 logarithm of the input n, but reduces wastage incurred when encoding non-power of two value ranges by encoding one fewer bits for the lower part of the value range. For example, when n is equal to five, the encodings are as follows (full binary encodings are also presented for comparison):
<table class="table table-sm table-bordered">
<thead>
<tr>
<th>Value</th>
<th>Full binary encoding</th>
<th>ns(n) encoding</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>000</td>
<td>00</td>
</tr>
<tr>
<td>1</td>
<td>001</td>
<td>01</td>
</tr>
<tr>
<td>2</td>
<td>010</td>
<td>10</td>
</tr>
<tr>
<td>3</td>
<td>011</td>
<td>110</td>
</tr>
<tr>
<td>4</td>
<td>100</td>
<td>111</td>
</tr>
</tbody>
</table>
The parsing process for this descriptor is specified as:
<pre><code>
ns(n) {
w = 0
x = n
while (x != 0) {
x = x >> 1
w++
}
m = (1 << w) - n
<b>v</b> = f(w - 1)
if (v < m)
return v
<b>extra_bit</b> = f(1)
return (v << 1) - m + extra_bit
}
</code></pre>
The serialization process for this descriptor is specified as:
<pre><code>
write_ns(n,v) {
if (n == 1) return
w = 0
x = n
while (x != 0) {
x = x >> 1
w++
}
m = (1 << w) - n
if (v < m)
write_f(w - 1, v)
else
write_f(w, v + m)
}
</code></pre>
where write_f(n,v) writes the bit stream representation of v using n bits.
<pre><code>
dependency_descriptor( sz ) {
TotalConsumedBits = 0
mandatory_descriptor_fields()
if (sz > 3) {
extended_descriptor_fields()
} else {
no_extended_descriptor_fields()
}
frame_dependency_definition()
<b>zero_padding</b> = f(sz * 8 - TotalConsumedBits)
}
</code></pre>
<pre><code>
mandatory_descriptor_fields() {
<b>start_of_frame</b> = f(1)
<b>end_of_frame</b> = f(1)
<b>frame_dependency_template_id</b> = f(6)
<b>frame_number</b> = f(16)
}
</code></pre>
<pre><code>
extended_descriptor_fields() {
<b>template_dependency_structure_present_flag</b> = f(1)
<b>active_decode_targets_present_flag</b> = f(1)
<b>custom_dtis_flag</b> = f(1)
<b>custom_fdiffs_flag</b> = f(1)
<b>custom_chains_flag</b> = f(1)
if (template_dependency_structure_present_flag) {
template_dependency_structure()
active_decode_targets_bitmask = (1 << DtCnt) - 1
}
if (active_decode_targets_present_flag) {
<b>active_decode_targets_bitmask</b> = f(DtCnt)
}
}
</code></pre>