summaryrefslogtreecommitdiff
path: root/ext/openh264
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2017-03-25 03:37:35 +1100
committerJan Schmidt <jan@centricular.com>2019-01-30 03:00:49 +1100
commit984b150e65c9a9d2f4b34cfc59c3083c4b9d1196 (patch)
tree529e25a469fab40a1e49e61145a592332d8ad2cb /ext/openh264
parentf9c04f3987dfdf3e0b13044dc4936dc1583ac323 (diff)
downloadgstreamer-plugins-bad-984b150e65c9a9d2f4b34cfc59c3083c4b9d1196.tar.gz
openh264dec: Fix up EOS handling
If the last frame(s) produce errors, then we need to drop them or else we spin forever failing to decode a frame and thinking it'll get better if we wait for more data that's never coming.
Diffstat (limited to 'ext/openh264')
-rw-r--r--ext/openh264/gstopenh264dec.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/openh264/gstopenh264dec.cpp b/ext/openh264/gstopenh264dec.cpp
index a7910f066..f82231a45 100644
--- a/ext/openh264/gstopenh264dec.cpp
+++ b/ext/openh264/gstopenh264dec.cpp
@@ -202,6 +202,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
guint i;
guint8 *p;
guint row_stride, component_width, component_height, src_width, row;
+ gboolean at_eos = (frame == NULL);
if (frame) {
if (!gst_buffer_map (frame->input_buffer, &map_info, GST_MAP_READ)) {
@@ -247,6 +248,15 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
}
}
+ /* No output available yet */
+ if (dst_buf_info.iBufferStatus != 1) {
+ if (at_eos)
+ return GST_FLOW_EOS;
+
+ gst_video_codec_frame_unref (frame);
+ return GST_FLOW_OK;
+ }
+
/* FIXME: openh264 has no way for us to get a connection
* between the input and output frames, we just have to
* guess based on the input. Fortunately openh264 can
@@ -257,10 +267,13 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
return GST_FLOW_EOS;
}
- /* No output available yet */
- if (dst_buf_info.iBufferStatus != 1) {
- gst_video_codec_frame_unref (frame);
- return GST_FLOW_OK;
+ {
+ GstClockTime pts = dst_buf_info.uiOutYuvTimeStamp;
+ if (pts != frame->pts) {
+ GST_DEBUG_OBJECT (decoder, "Got output PTS %" GST_TIME_FORMAT
+ " but expected %" GST_TIME_FORMAT, GST_TIME_ARGS (pts),
+ GST_TIME_ARGS (frame->pts));
+ }
}
actual_width = dst_buf_info.UsrData.sSystemBuffer.iWidth;