summaryrefslogtreecommitdiff
path: root/omx
diff options
context:
space:
mode:
authorShinya Saito <ssaito@igel.co.jp>2019-12-10 18:34:25 +0900
committerShinya Saito <ssaito@igel.co.jp>2019-12-11 15:53:29 +0900
commit847fc08824597f7dabe534ddba0517665e02592c (patch)
tree44ea3944a14f0c0b027b2912c5a2079ddc3c57e3 /omx
parent2939a46dd26c7562a108bf050413c875536df346 (diff)
omxvideoenc: Add stride check for input buffer extraction
Stride of input buffer may be different from that of omx input port even if both sizes are the same.
Diffstat (limited to 'omx')
-rw-r--r--omx/gstomxvideoenc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 15f55f9..3f31d23 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -2497,6 +2497,8 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
OMX_PARAM_PORTDEFINITIONTYPE *port_def = &self->enc_in_port->port_def;
gboolean ret = FALSE;
GstVideoFrame frame;
+ GstVideoMeta *meta = gst_buffer_get_video_meta (inbuf);
+ gint stride = meta ? meta->stride[0] : info->stride[0];
if (info->width != port_def->format.video.nFrameWidth ||
info->height != port_def->format.video.nFrameHeight) {
@@ -2546,8 +2548,9 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
}
/* Same strides and everything */
- if (gst_buffer_get_size (inbuf) ==
- outbuf->omx_buf->nAllocLen - outbuf->omx_buf->nOffset) {
+ if ((gst_buffer_get_size (inbuf) ==
+ outbuf->omx_buf->nAllocLen - outbuf->omx_buf->nOffset) &&
+ (stride == port_def->format.video.nStride)) {
outbuf->omx_buf->nFilledLen = gst_buffer_get_size (inbuf);
GST_LOG_OBJECT (self, "Matched strides - direct copy %u bytes",