mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
h264parse: Drop filler data
When skipping data, check if they are filler bytes. If so, drop the data instead of skipping. We don't want to output filler bytes, but they shouldn't cause a discontinuity. https://bugzilla.gnome.org/show_bug.cgi?id=768125
This commit is contained in:
parent
11a7362993
commit
c19d1b46c3
1 changed files with 21 additions and 0 deletions
|
@ -1053,6 +1053,7 @@ gst_h264_parse_handle_frame (GstBaseParse * parse,
|
||||||
GstH264NalUnit nalu;
|
GstH264NalUnit nalu;
|
||||||
GstH264ParserResult pres;
|
GstH264ParserResult pres;
|
||||||
gint framesize;
|
gint framesize;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (frame->buffer,
|
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (frame->buffer,
|
||||||
GST_BUFFER_FLAG_DISCONT))) {
|
GST_BUFFER_FLAG_DISCONT))) {
|
||||||
|
@ -1105,6 +1106,22 @@ gst_h264_parse_handle_frame (GstBaseParse * parse,
|
||||||
switch (pres) {
|
switch (pres) {
|
||||||
case GST_H264_PARSER_OK:
|
case GST_H264_PARSER_OK:
|
||||||
if (nalu.sc_offset > 0) {
|
if (nalu.sc_offset > 0) {
|
||||||
|
int i;
|
||||||
|
gboolean is_filler_data = TRUE;
|
||||||
|
/* Handle filler data */
|
||||||
|
for (i = 0; i < nalu.sc_offset; i++) {
|
||||||
|
if (data[i] != 0x00) {
|
||||||
|
is_filler_data = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_filler_data) {
|
||||||
|
GST_DEBUG_OBJECT (parse, "Dropping filler data %d", nalu.sc_offset);
|
||||||
|
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_DROP;
|
||||||
|
gst_buffer_unmap (buffer, &map);
|
||||||
|
ret = gst_base_parse_finish_frame (parse, frame, nalu.sc_offset);
|
||||||
|
goto drop;
|
||||||
|
}
|
||||||
*skipsize = nalu.sc_offset;
|
*skipsize = nalu.sc_offset;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
@ -1240,6 +1257,10 @@ out:
|
||||||
gst_buffer_unmap (buffer, &map);
|
gst_buffer_unmap (buffer, &map);
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
|
drop:
|
||||||
|
GST_DEBUG_OBJECT (h264parse, "Dropped data");
|
||||||
|
return ret;
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
GST_DEBUG_OBJECT (h264parse, "skipping %d", *skipsize);
|
GST_DEBUG_OBJECT (h264parse, "skipping %d", *skipsize);
|
||||||
/* If we are collecting access units, we need to preserve the initial
|
/* If we are collecting access units, we need to preserve the initial
|
||||||
|
|
Loading…
Reference in a new issue