diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index e78cb77b84..d99132a920 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -926,7 +926,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx, case COLOR_FormatYUV420SemiPlanar:{ gint i, j, height; guint8 *src, *dest; - gint src_stride, dest_stride; + gint src_stride, dest_stride, fixed_stride; gint row_length; GstVideoFrame vframe; @@ -936,25 +936,30 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx, goto done; } - /* FIXME: This is untested! */ + /* Samsung Galaxy S3 seems to report wrong strides. + I.e. BigBuckBunny 854x480 H264 reports a stride of 864 when it is + actually 854, so we use width instead of stride here. + This is obviously bound to break in the future. */ + if (g_str_has_prefix (klass->codec_info->name, "OMX.SEC.")) { + fixed_stride = self->width; + } else { + fixed_stride = self->stride; + } + gst_video_frame_map (&vframe, info, outbuf, GST_MAP_WRITE); + for (i = 0; i < 2; i++) { - if (i == 0) { - src_stride = self->stride; - dest_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, i); - } else { - src_stride = self->stride; - dest_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, i); - } + src_stride = fixed_stride; + dest_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, i); src = buf->data + buffer_info->offset; if (i == 0) { - src += self->crop_top * self->stride; + src += self->crop_top * fixed_stride; src += self->crop_left; row_length = self->width; } else if (i == 1) { - src += self->slice_height * self->stride; - src += self->crop_top * self->stride; + src += self->slice_height * fixed_stride; + src += self->crop_top * fixed_stride; src += self->crop_left; row_length = self->width; }