mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
matroskamux: Don't get stuck in an infinite loop with Dirac
At the end, Dirac streams have an EOS packet with 0 length. Don't ever sit in an infinite loop when processing one. Allows muxing Dirac into mkv to complete successfully.
This commit is contained in:
parent
123181a114
commit
600516be90
1 changed files with 7 additions and 2 deletions
|
@ -2431,6 +2431,8 @@ gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track,
|
||||||
return hdr;
|
return hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DIRAC_PARSE_CODE_SEQUENCE 0x00
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
GstMatroskaPad * collect_pad, GstBuffer * buf)
|
GstMatroskaPad * collect_pad, GstBuffer * buf)
|
||||||
|
@ -2451,13 +2453,13 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
|
|
||||||
/* Check if this buffer contains a picture packet */
|
/* Check if this buffer contains a picture packet */
|
||||||
while (size >= 13) {
|
while (size >= 13) {
|
||||||
if (GST_READ_UINT32_BE (data) != 0x42424344) {
|
if (GST_READ_UINT32_BE (data) != 0x42424344 /* 'BBCD' */ ) {
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_code = GST_READ_UINT8 (data + 4);
|
parse_code = GST_READ_UINT8 (data + 4);
|
||||||
if (parse_code == 0x00) {
|
if (parse_code == DIRAC_PARSE_CODE_SEQUENCE) {
|
||||||
if (ctx->dirac_unit) {
|
if (ctx->dirac_unit) {
|
||||||
gst_buffer_unref (ctx->dirac_unit);
|
gst_buffer_unref (ctx->dirac_unit);
|
||||||
ctx->dirac_unit = NULL;
|
ctx->dirac_unit = NULL;
|
||||||
|
@ -2469,6 +2471,9 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
|
|
||||||
next_parse_offset = GST_READ_UINT32_BE (data + 5);
|
next_parse_offset = GST_READ_UINT32_BE (data + 5);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (next_parse_offset == 0))
|
||||||
|
break;
|
||||||
|
|
||||||
data += next_parse_offset;
|
data += next_parse_offset;
|
||||||
size -= next_parse_offset;
|
size -= next_parse_offset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue