• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * gstrtpvp9pay.c - Source for GstRtpVP9Pay
3  * Copyright (C) 2011 Sjoerd Simons <sjoerd@luon.net>
4  * Copyright (C) 2011 Collabora Ltd.
5  *   Contact: Youness Alaoui <youness.alaoui@collabora.co.uk>
6  * Copyright (C) 2015 Stian Selnes <stian@pexip.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
26 
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 
31 #include <gst/base/gstbitreader.h>
32 #include <gst/rtp/gstrtppayloads.h>
33 #include <gst/rtp/gstrtpbuffer.h>
34 #include <gst/video/video.h>
35 #include "gstrtpelements.h"
36 #include "dboolhuff.h"
37 #include "gstrtpvp9pay.h"
38 #include "gstrtputils.h"
39 
40 GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp9_pay_debug);
41 #define GST_CAT_DEFAULT gst_rtp_vp9_pay_debug
42 
43 #define DEFAULT_PICTURE_ID_MODE VP9_PAY_NO_PICTURE_ID
44 
45 enum
46 {
47   PROP_0,
48   PROP_PICTURE_ID_MODE
49 };
50 
51 #define GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE (gst_rtp_vp9_pay_picture_id_mode_get_type())
52 static GType
gst_rtp_vp9_pay_picture_id_mode_get_type(void)53 gst_rtp_vp9_pay_picture_id_mode_get_type (void)
54 {
55   static GType mode_type = 0;
56   static const GEnumValue modes[] = {
57     {VP9_PAY_NO_PICTURE_ID, "No Picture ID", "none"},
58     {VP9_PAY_PICTURE_ID_7BITS, "7-bit Picture ID", "7-bit"},
59     {VP9_PAY_PICTURE_ID_15BITS, "15-bit Picture ID", "15-bit"},
60     {0, NULL, NULL},
61   };
62 
63   if (!mode_type) {
64     mode_type = g_enum_register_static ("GstVP9RTPPayMode", modes);
65   }
66   return mode_type;
67 }
68 
69 static void gst_rtp_vp9_pay_get_property (GObject * object, guint prop_id,
70     GValue * value, GParamSpec * pspec);
71 static void gst_rtp_vp9_pay_set_property (GObject * object, guint prop_id,
72     const GValue * value, GParamSpec * pspec);
73 
74 static GstFlowReturn gst_rtp_vp9_pay_handle_buffer (GstRTPBasePayload * payload,
75     GstBuffer * buffer);
76 static gboolean gst_rtp_vp9_pay_sink_event (GstRTPBasePayload * payload,
77     GstEvent * event);
78 static gboolean gst_rtp_vp9_pay_set_caps (GstRTPBasePayload * payload,
79     GstCaps * caps);
80 
81 G_DEFINE_TYPE (GstRtpVP9Pay, gst_rtp_vp9_pay, GST_TYPE_RTP_BASE_PAYLOAD);
82 GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtpvp9pay, "rtpvp9pay",
83     GST_RANK_MARGINAL, GST_TYPE_RTP_VP9_PAY, rtp_element_init (plugin));
84 
85 static GstStaticPadTemplate gst_rtp_vp9_pay_src_template =
86 GST_STATIC_PAD_TEMPLATE ("src",
87     GST_PAD_SRC,
88     GST_PAD_ALWAYS,
89     GST_STATIC_CAPS ("application/x-rtp, "
90         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ","
91         "clock-rate = (int) 90000, encoding-name = (string) { \"VP9\", \"VP9-DRAFT-IETF-01\" }"));
92 
93 static GstStaticPadTemplate gst_rtp_vp9_pay_sink_template =
94 GST_STATIC_PAD_TEMPLATE ("sink",
95     GST_PAD_SINK,
96     GST_PAD_ALWAYS,
97     GST_STATIC_CAPS ("video/x-vp9"));
98 
99 static void
gst_rtp_vp9_pay_init(GstRtpVP9Pay * obj)100 gst_rtp_vp9_pay_init (GstRtpVP9Pay * obj)
101 {
102   obj->picture_id_mode = DEFAULT_PICTURE_ID_MODE;
103   if (obj->picture_id_mode == VP9_PAY_PICTURE_ID_7BITS)
104     obj->picture_id = g_random_int_range (0, G_MAXUINT8) & 0x7F;
105   else if (obj->picture_id_mode == VP9_PAY_PICTURE_ID_15BITS)
106     obj->picture_id = g_random_int_range (0, G_MAXUINT16) & 0x7FFF;
107 }
108 
109 static void
gst_rtp_vp9_pay_class_init(GstRtpVP9PayClass * gst_rtp_vp9_pay_class)110 gst_rtp_vp9_pay_class_init (GstRtpVP9PayClass * gst_rtp_vp9_pay_class)
111 {
112   GObjectClass *gobject_class = G_OBJECT_CLASS (gst_rtp_vp9_pay_class);
113   GstElementClass *element_class = GST_ELEMENT_CLASS (gst_rtp_vp9_pay_class);
114   GstRTPBasePayloadClass *pay_class =
115       GST_RTP_BASE_PAYLOAD_CLASS (gst_rtp_vp9_pay_class);
116 
117   gobject_class->set_property = gst_rtp_vp9_pay_set_property;
118   gobject_class->get_property = gst_rtp_vp9_pay_get_property;
119 
120   g_object_class_install_property (gobject_class, PROP_PICTURE_ID_MODE,
121       g_param_spec_enum ("picture-id-mode", "Picture ID Mode",
122           "The picture ID mode for payloading",
123           GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE, DEFAULT_PICTURE_ID_MODE,
124           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
125 
126   gst_element_class_add_static_pad_template (element_class,
127       &gst_rtp_vp9_pay_sink_template);
128   gst_element_class_add_static_pad_template (element_class,
129       &gst_rtp_vp9_pay_src_template);
130 
131   gst_element_class_set_static_metadata (element_class, "RTP VP9 payloader",
132       "Codec/Payloader/Network/RTP",
133       "Puts VP9 video in RTP packets)", "Stian Selnes <stian@pexip.com>");
134 
135   pay_class->handle_buffer = gst_rtp_vp9_pay_handle_buffer;
136   pay_class->sink_event = gst_rtp_vp9_pay_sink_event;
137   pay_class->set_caps = gst_rtp_vp9_pay_set_caps;
138 
139   GST_DEBUG_CATEGORY_INIT (gst_rtp_vp9_pay_debug, "rtpvp9pay", 0,
140       "VP9 Video RTP Payloader");
141 
142   gst_type_mark_as_plugin_api (GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE, 0);
143 }
144 
145 static void
gst_rtp_vp9_pay_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)146 gst_rtp_vp9_pay_set_property (GObject * object,
147     guint prop_id, const GValue * value, GParamSpec * pspec)
148 {
149   GstRtpVP9Pay *rtpvp9pay = GST_RTP_VP9_PAY (object);
150 
151   switch (prop_id) {
152     case PROP_PICTURE_ID_MODE:
153       rtpvp9pay->picture_id_mode = g_value_get_enum (value);
154       if (rtpvp9pay->picture_id_mode == VP9_PAY_PICTURE_ID_7BITS)
155         rtpvp9pay->picture_id = g_random_int_range (0, G_MAXUINT8) & 0x7F;
156       else if (rtpvp9pay->picture_id_mode == VP9_PAY_PICTURE_ID_15BITS)
157         rtpvp9pay->picture_id = g_random_int_range (0, G_MAXUINT16) & 0x7FFF;
158       break;
159     default:
160       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
161       break;
162   }
163 }
164 
165 static void
gst_rtp_vp9_pay_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec)166 gst_rtp_vp9_pay_get_property (GObject * object,
167     guint prop_id, GValue * value, GParamSpec * pspec)
168 {
169   GstRtpVP9Pay *rtpvp9pay = GST_RTP_VP9_PAY (object);
170 
171   switch (prop_id) {
172     case PROP_PICTURE_ID_MODE:
173       g_value_set_enum (value, rtpvp9pay->picture_id_mode);
174       break;
175     default:
176       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
177       break;
178   }
179 }
180 
181 #define VP9_PROFILE_0 0
182 #define VP9_PROFILE_1 1
183 #define VP9_PROFILE_2 2
184 #define VP9_PROFILE_3 3
185 #define VP9_FRAME_MARKER 0x2
186 #define VPX_CS_SRGB 7
187 
188 static gboolean
gst_rtp_vp9_pay_parse_frame(GstRtpVP9Pay * self,GstBuffer * buffer,gsize buffer_size)189 gst_rtp_vp9_pay_parse_frame (GstRtpVP9Pay * self, GstBuffer * buffer,
190     gsize buffer_size)
191 {
192   GstMapInfo map = GST_MAP_INFO_INIT;
193   GstBitReader reader;
194   guint8 *data;
195   gsize size;
196   gboolean keyframe;
197   guint32 tmp, profile;
198 
199   if (G_UNLIKELY (buffer_size < 3))
200     goto error;
201 
202   if (!gst_buffer_map (buffer, &map, GST_MAP_READ) || !map.data)
203     goto error;
204 
205   data = map.data;
206   size = map.size;
207 
208   gst_bit_reader_init (&reader, data, size);
209 
210 
211   /* frame marker */
212   if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 2)
213       || tmp != VP9_FRAME_MARKER)
214     goto error;
215 
216   /* profile, variable length */
217   if (!gst_bit_reader_get_bits_uint32 (&reader, &profile, 2))
218     goto error;
219   if (profile > 2) {
220     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 1))
221       goto error;
222     profile += tmp;
223   }
224 
225   /* show existing frame */
226   if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 1))
227     goto error;
228   if (tmp) {
229     if (!gst_bit_reader_skip (&reader, 3))
230       goto error;
231     return TRUE;
232   }
233 
234   /* frame type */
235   if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 1))
236     goto error;
237   self->is_keyframe = keyframe = (tmp == 0);
238 
239   /* show frame and resilient mode */
240   if (!gst_bit_reader_skip (&reader, 2))
241     goto error;
242 
243   if (keyframe) {
244     /* sync code */
245     const guint32 sync_code = 0x498342;
246     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 24))
247       goto error;
248     if (tmp != sync_code)
249       goto error;
250 
251     if (profile >= VP9_PROFILE_2) {
252       /* bit depth */
253       if (!gst_bit_reader_skip (&reader, 1))
254         goto error;
255     }
256 
257     /* color space */
258     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 3))
259       goto error;
260     if (tmp != VPX_CS_SRGB) {
261       /* color range */
262       if (!gst_bit_reader_skip (&reader, 1))
263         goto error;
264       if (profile == VP9_PROFILE_1 || profile == VP9_PROFILE_3) {
265         /* subsampling + reserved bit */
266         if (!gst_bit_reader_skip (&reader, 2 + 1))
267           goto error;
268       }
269     } else {
270       if (profile == VP9_PROFILE_1 || profile == VP9_PROFILE_3)
271         /* reserved bit */
272         if (!gst_bit_reader_skip (&reader, 1))
273           goto error;
274     }
275 
276     /* frame size */
277     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 16))
278       goto error;
279     self->width = tmp + 1;
280     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 16))
281       goto error;
282     self->height = tmp + 1;
283 
284     /* render size */
285     if (!gst_bit_reader_get_bits_uint32 (&reader, &tmp, 1))
286       goto error;
287     if (tmp) {
288       if (!gst_bit_reader_skip (&reader, 32))
289         goto error;
290     }
291 
292     GST_INFO_OBJECT (self, "parsed width=%d height=%d", self->width,
293         self->height);
294   }
295 
296 
297   gst_buffer_unmap (buffer, &map);
298   return TRUE;
299 
300 error:
301   GST_DEBUG ("Failed to parse frame");
302   if (map.memory != NULL) {
303     gst_buffer_unmap (buffer, &map);
304   }
305   return FALSE;
306 }
307 
308 static gsize
gst_rtp_vp9_calc_header_len(GstRtpVP9Pay * self,gboolean start)309 gst_rtp_vp9_calc_header_len (GstRtpVP9Pay * self, gboolean start)
310 {
311   gsize len = 1;
312 
313   switch (self->picture_id_mode) {
314     case VP9_PAY_PICTURE_ID_7BITS:
315       len += 1;
316       break;
317     case VP9_PAY_PICTURE_ID_15BITS:
318       len += 2;
319     default:
320       break;
321   }
322 
323   /* Assume non-flexible mode */
324   /* Assume L-bit not set, no L header */
325 
326   if (self->is_keyframe && start) {
327     /* Assume V-bit set */
328     /* FIXME: SS depends on layers and prediction structure */
329     /* For now assume 1 spatial and 1 temporal layer. */
330     /* FIXME: Only for the first packet in the key frame */
331     len += 8;
332   }
333 
334   return len;
335 }
336 
337 /* VP9 RTP header, non-flexible mode:
338 
339          0 1 2 3 4 5 6 7
340         +-+-+-+-+-+-+-+-+
341         |I|P|L|F|B|E|V|-| (REQUIRED)
342         +-+-+-+-+-+-+-+-+
343    I:   |M| PICTURE ID  | (RECOMMENDED)
344         +-+-+-+-+-+-+-+-+
345    M:   | EXTENDED PID  | (RECOMMENDED)
346         +-+-+-+-+-+-+-+-+
347    L:   |  T  |U|  S  |D| (CONDITIONALLY RECOMMENDED)
348         +-+-+-+-+-+-+-+-+                             -\
349    P,F: | P_DIFF    |X|N| (CONDITIONALLY RECOMMENDED)  .
350         +-+-+-+-+-+-+-+-+                              . - up to 3 times
351    X:   |EXTENDED P_DIFF| (OPTIONAL)                   .
352         +-+-+-+-+-+-+-+-+                             -/
353    V:   | SS            |
354         | ..            |
355         +-+-+-+-+-+-+-+-+
356 
357    Scalability structure (SS)
358      (from https://chromium.googlesource.com/external/webrtc/+/HEAD/webrtc/modules/rtp_rtcp/source/rtp_format_vp9.cc
359      since latest draft is not up to date with chromium)
360 
361         +-+-+-+-+-+-+-+-+
362    V:   | N_S |Y|G|-|-|-|
363         +-+-+-+-+-+-+-+-+              -|
364    Y:   |     WIDTH     | (OPTIONAL)    .
365         +               +               .
366         |               | (OPTIONAL)    .
367         +-+-+-+-+-+-+-+-+               . N_S + 1 times
368         |     HEIGHT    | (OPTIONAL)    .
369         +               +               .
370         |               | (OPTIONAL)    .
371         +-+-+-+-+-+-+-+-+              -|
372    G:   |      N_G      | (OPTIONAL)
373         +-+-+-+-+-+-+-+-+                           -|
374    N_G: |  T  |U| R |-|-| (OPTIONAL)                 .
375         +-+-+-+-+-+-+-+-+              -|            . N_G times
376         |    P_DIFF     | (OPTIONAL)    . R times    .
377         +-+-+-+-+-+-+-+-+              -|           -|
378 
379 **/
380 
381 /* When growing the vp9 header keep max payload len calculation in sync */
382 static GstBuffer *
gst_rtp_vp9_create_header_buffer(GstRtpVP9Pay * self,gboolean start,gboolean mark,GstBuffer * in)383 gst_rtp_vp9_create_header_buffer (GstRtpVP9Pay * self,
384     gboolean start, gboolean mark, GstBuffer * in)
385 {
386   GstBuffer *out;
387   guint8 *p;
388   GstRTPBuffer rtpbuffer = GST_RTP_BUFFER_INIT;
389   guint off = 1;
390   guint hdrlen = gst_rtp_vp9_calc_header_len (self, start);
391 
392   out =
393       gst_rtp_base_payload_allocate_output_buffer (GST_RTP_BASE_PAYLOAD (self),
394       hdrlen, 0, 0);
395   gst_rtp_buffer_map (out, GST_MAP_READWRITE, &rtpbuffer);
396   p = gst_rtp_buffer_get_payload (&rtpbuffer);
397   p[0] = 0x0;
398 
399   if (self->picture_id_mode != VP9_PAY_NO_PICTURE_ID) {
400     p[0] |= 0x80;
401     if (self->picture_id_mode == VP9_PAY_PICTURE_ID_7BITS) {
402       /* M=0 */
403       p[off++] = self->picture_id & 0x7F;
404     } else {
405       /* M=1 */
406       p[off++] = 0x80 | ((self->picture_id & 0x7FFF) >> 8);
407       p[off++] = self->picture_id & 0xFF;
408     }
409   }
410 
411   if (!self->is_keyframe)
412     p[0] |= 0x40;
413   if (start)
414     p[0] |= 0x08;
415   if (mark)
416     p[0] |= 0x04;
417 
418   if (self->is_keyframe && start) {
419     p[0] |= 0x02;
420     /* scalability structure, hard coded for now to be similar to chromium for
421      * quick and dirty interop */
422     p[off++] = 0x18;            /* N_S=0 Y=1 G=1 */
423     p[off++] = self->width >> 8;
424     p[off++] = self->width & 0xFF;
425     p[off++] = self->height >> 8;
426     p[off++] = self->height & 0xFF;
427     p[off++] = 0x01;            /* N_G=1 */
428     p[off++] = 0x04;            /* T=0, U=0, R=1 */
429     p[off++] = 0x01;            /* P_DIFF=1 */
430   }
431 
432   g_assert_cmpint (off, ==, hdrlen);
433 
434   gst_rtp_buffer_set_marker (&rtpbuffer, mark);
435 
436   gst_rtp_buffer_unmap (&rtpbuffer);
437 
438   GST_BUFFER_DURATION (out) = GST_BUFFER_DURATION (in);
439   GST_BUFFER_PTS (out) = GST_BUFFER_PTS (in);
440 
441   return out;
442 }
443 
444 static guint
gst_rtp_vp9_payload_next(GstRtpVP9Pay * self,GstBufferList * list,guint offset,GstBuffer * buffer,gsize buffer_size,gsize max_payload_len)445 gst_rtp_vp9_payload_next (GstRtpVP9Pay * self, GstBufferList * list,
446     guint offset, GstBuffer * buffer, gsize buffer_size, gsize max_payload_len)
447 {
448   GstBuffer *header;
449   GstBuffer *sub;
450   GstBuffer *out;
451   gboolean mark;
452   gsize remaining;
453   gsize available;
454 
455   remaining = buffer_size - offset;
456   available = max_payload_len;
457   if (available > remaining)
458     available = remaining;
459 
460   mark = (remaining == available);
461   header = gst_rtp_vp9_create_header_buffer (self, offset == 0, mark, buffer);
462   sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, available);
463 
464   gst_rtp_copy_video_meta (self, header, buffer);
465 
466   out = gst_buffer_append (header, sub);
467 
468   gst_buffer_list_insert (list, -1, out);
469 
470   return available;
471 }
472 
473 
474 static GstFlowReturn
gst_rtp_vp9_pay_handle_buffer(GstRTPBasePayload * payload,GstBuffer * buffer)475 gst_rtp_vp9_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
476 {
477   GstRtpVP9Pay *self = GST_RTP_VP9_PAY (payload);
478   GstFlowReturn ret;
479   GstBufferList *list;
480   gsize size, max_paylen;
481   guint offset, mtu, vp9_hdr_len;
482 
483   size = gst_buffer_get_size (buffer);
484 
485   if (G_UNLIKELY (!gst_rtp_vp9_pay_parse_frame (self, buffer, size))) {
486     GST_ELEMENT_ERROR (self, STREAM, ENCODE, (NULL),
487         ("Failed to parse VP9 frame"));
488     return GST_FLOW_ERROR;
489   }
490 
491   mtu = GST_RTP_BASE_PAYLOAD_MTU (payload);
492   vp9_hdr_len = gst_rtp_vp9_calc_header_len (self, TRUE);
493   max_paylen = gst_rtp_buffer_calc_payload_len (mtu - vp9_hdr_len, 0, 0);
494 
495   list = gst_buffer_list_new_sized ((size / max_paylen) + 1);
496 
497   offset = 0;
498   while (offset < size) {
499     offset +=
500         gst_rtp_vp9_payload_next (self, list, offset, buffer, size, max_paylen);
501   }
502 
503   ret = gst_rtp_base_payload_push_list (payload, list);
504 
505   /* Incremenent and wrap the picture id if it overflows */
506   if ((self->picture_id_mode == VP9_PAY_PICTURE_ID_7BITS &&
507           ++self->picture_id >= 0x80) ||
508       (self->picture_id_mode == VP9_PAY_PICTURE_ID_15BITS &&
509           ++self->picture_id >= 0x8000))
510     self->picture_id = 0;
511 
512   gst_buffer_unref (buffer);
513 
514   return ret;
515 }
516 
517 static gboolean
gst_rtp_vp9_pay_sink_event(GstRTPBasePayload * payload,GstEvent * event)518 gst_rtp_vp9_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event)
519 {
520   GstRtpVP9Pay *self = GST_RTP_VP9_PAY (payload);
521 
522   if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START) {
523     if (self->picture_id_mode == VP9_PAY_PICTURE_ID_7BITS)
524       self->picture_id = g_random_int_range (0, G_MAXUINT8) & 0x7F;
525     else if (self->picture_id_mode == VP9_PAY_PICTURE_ID_15BITS)
526       self->picture_id = g_random_int_range (0, G_MAXUINT16) & 0x7FFF;
527   }
528 
529   return GST_RTP_BASE_PAYLOAD_CLASS (gst_rtp_vp9_pay_parent_class)->sink_event
530       (payload, event);
531 }
532 
533 static gboolean
gst_rtp_vp9_pay_set_caps(GstRTPBasePayload * payload,GstCaps * caps)534 gst_rtp_vp9_pay_set_caps (GstRTPBasePayload * payload, GstCaps * caps)
535 {
536   GstCaps *src_caps;
537   const char *encoding_name = "VP9";
538 
539   src_caps = gst_pad_get_allowed_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload));
540   if (src_caps) {
541     GstStructure *s;
542     const GValue *value;
543 
544     s = gst_caps_get_structure (src_caps, 0);
545 
546     if (gst_structure_has_field (s, "encoding-name")) {
547       GValue default_value = G_VALUE_INIT;
548 
549       g_value_init (&default_value, G_TYPE_STRING);
550       g_value_set_static_string (&default_value, encoding_name);
551 
552       value = gst_structure_get_value (s, "encoding-name");
553       if (!gst_value_can_intersect (&default_value, value))
554         encoding_name = "VP9-DRAFT-IETF-01";
555     }
556     gst_caps_unref (src_caps);
557   }
558 
559   gst_rtp_base_payload_set_options (payload, "video", TRUE,
560       encoding_name, 90000);
561 
562   return gst_rtp_base_payload_set_outcaps (payload, NULL);
563 }
564