mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
mpeg4videoparse: avoid stale parsing state
This commit is contained in:
parent
afb5b28d66
commit
dbb1fecf08
1 changed files with 13 additions and 1 deletions
|
@ -321,6 +321,10 @@ gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstBuffer * buf,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME move into baseparse, or anything equivalent;
|
||||||
|
* see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */
|
||||||
|
#define GST_BASE_PARSE_FRAME_FLAG_PARSING 0x10000
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpeg4vparse_check_valid_frame (GstBaseParse * parse,
|
gst_mpeg4vparse_check_valid_frame (GstBaseParse * parse,
|
||||||
GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
|
GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
|
||||||
|
@ -337,6 +341,15 @@ retry:
|
||||||
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) - off < 5))
|
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) - off < 5))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* avoid stale cached parsing state */
|
||||||
|
if (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_PARSING)) {
|
||||||
|
GST_LOG_OBJECT (mp4vparse, "parsing new frame");
|
||||||
|
gst_mpeg4vparse_reset_frame (mp4vparse);
|
||||||
|
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_PARSING;
|
||||||
|
} else {
|
||||||
|
GST_LOG_OBJECT (mp4vparse, "resuming frame parsing");
|
||||||
|
}
|
||||||
|
|
||||||
/* if already found a previous start code, e.g. start of frame, go for next */
|
/* if already found a previous start code, e.g. start of frame, go for next */
|
||||||
if (mp4vparse->last_sc >= 0) {
|
if (mp4vparse->last_sc >= 0) {
|
||||||
off = mp4vparse->last_sc;
|
off = mp4vparse->last_sc;
|
||||||
|
@ -410,7 +423,6 @@ next:
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
*framesize = off;
|
*framesize = off;
|
||||||
gst_mpeg4vparse_reset_frame (mp4vparse);
|
|
||||||
} else {
|
} else {
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue