GNOME Bugzilla – Bug 734156
androidmedia: doesn't calculate framesize for COLOR_FormatYUV420Planar correctly
Last modified: 2014-10-14 07:43:54 UTC
In sys/androidmedia/gstamc.c, line 2479 Have this: case COLOR_FormatYUV420Planar:{ if (stride == 0 || slice_height == 0) { GST_ERROR ("Stride or slice height is 0"); return FALSE; } frame_size = stride * slice_height + 2 * (((stride + 1) / 2) * (slice_height + 1) / 2); break; } so for a width(stride)=640, height(slice_height)=480, I think that the frame_size should be 460800 bytes, but the calculation gives 461120 bytes. bad calculation is frame_size = 640*480 + 2 * (((640+1)/2) * (480+1)/2) = 461120 (use integer division) good calculation is frame_size = 640*480 + 2 * ((640+1)/2) * ((480+1)/2) = 460800 I think that the code is missing some parens... frame_size = stride * slice_height + 2 * ( ((stride + 1) / 2) * ((slice_height + 1) / 2) );
commit 66a4572c125f63f48761d572f99de736754920da Author: Sebastian Dröge <sebastian@centricular.com> Date: Thu Oct 2 10:26:43 2014 +0300 androidmedia: Fix calculation of the frame size for COLOR_FormatYUV420Planar https://bugzilla.gnome.org/show_bug.cgi?id=734156
Thanks for reporting this bug and proposing a fix!