androidmedia: Fix copying of raw video frames on Samsung Galaxy S3 with Exynos 4 SOC

This commit is contained in:
Xavi Artigas 2013-06-20 09:52:31 +02:00 committed by Sebastian Dröge
parent 44807dcc1a
commit 85c1510d6b

View file

@ -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;
}