omxvideoenc: early return in fill_buffer() if something goes wrong

If something goes wrong while trying to manually copy the input buffer,
the 'break' was moving us out of the 'for' loop but not out of the switch block.
So we ended up calling gst_video_frame_unmap() a second time (raising
assertions) and returning TRUE rather than FALSE.

Reproduced with a WIP zynqultrascaleplus OMX branch reporting wrong
buffer sizes and so triggering this bug.

https://bugzilla.gnome.org/show_bug.cgi?id=792167
This commit is contained in:
Guillaume Desmottes 2018-01-03 16:07:18 +01:00 committed by Tim-Philipp Müller
parent 19be4a0546
commit 5fa96cab7b

View file

@ -1579,7 +1579,7 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
if (!gst_video_frame_map (&frame, info, inbuf, GST_MAP_READ)) {
GST_ERROR_OBJECT (self, "Invalid input buffer size");
ret = FALSE;
break;
goto done;
}
for (i = 0; i < 3; i++) {
@ -1615,7 +1615,7 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
gst_video_frame_unmap (&frame);
GST_ERROR_OBJECT (self, "Invalid output buffer size");
ret = FALSE;
break;
goto done;
}
for (j = 0; j < height; j++) {
@ -1645,7 +1645,7 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
if (!gst_video_frame_map (&frame, info, inbuf, GST_MAP_READ)) {
GST_ERROR_OBJECT (self, "Invalid input buffer size");
ret = FALSE;
break;
goto done;
}
dest_stride = port_def->format.video.nStride;
@ -1674,7 +1674,7 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
gst_video_frame_unmap (&frame);
GST_ERROR_OBJECT (self, "Invalid output buffer size");
ret = FALSE;
break;
goto done;
}
for (j = 0; j < height; j++) {