mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
vp8depay: Don't lock/map every non-keyframe buffer twice
Just copy the complete header instead of first looking at the first byte and then at the remaining 10 bytes.
This commit is contained in:
parent
600942788d
commit
ceaf90f027
1 changed files with 23 additions and 28 deletions
|
@ -173,9 +173,9 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
|
|||
/* Marker indicates that it was the last rtp packet for this frame */
|
||||
if (gst_rtp_buffer_get_marker (&rtpbuffer)) {
|
||||
GstBuffer *out;
|
||||
guint8 flag0;
|
||||
guint8 header[10];
|
||||
|
||||
gst_adapter_copy (self->adapter, &flag0, 0, 1);
|
||||
gst_adapter_copy (self->adapter, &header, 0, 10);
|
||||
|
||||
out = gst_adapter_take_buffer (self->adapter,
|
||||
gst_adapter_available (self->adapter));
|
||||
|
@ -185,7 +185,7 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
|
|||
|
||||
/* mark keyframes */
|
||||
out = gst_buffer_make_writable (out);
|
||||
if ((flag0 & 0x01)) {
|
||||
if ((header[0] & 0x01)) {
|
||||
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
if (!self->caps_sent) {
|
||||
|
@ -197,17 +197,13 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
|
|||
TRUE, 0));
|
||||
}
|
||||
} else {
|
||||
GstMapInfo info;
|
||||
guint profile, width, height;
|
||||
|
||||
GST_BUFFER_FLAG_UNSET (out, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
|
||||
if (gst_buffer_map (out, &info, GST_MAP_READ)) {
|
||||
guint profile, width, height;
|
||||
|
||||
profile = (flag0 & 0x0e) >> 1;
|
||||
width = GST_READ_UINT16_LE (info.data + 6) & 0x3fff;
|
||||
height = GST_READ_UINT16_LE (info.data + 8) & 0x3fff;
|
||||
gst_buffer_unmap (out, &info);
|
||||
profile = (header[0] & 0x0e) >> 1;
|
||||
width = GST_READ_UINT16_LE (header + 6) & 0x3fff;
|
||||
height = GST_READ_UINT16_LE (header + 8) & 0x3fff;
|
||||
|
||||
if (G_UNLIKELY (self->last_width != width ||
|
||||
self->last_height != height || self->last_profile != profile)) {
|
||||
|
@ -230,7 +226,6 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
|
|||
self->last_profile = profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue