vpxdec: Fix calculation of width in bytes
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Sun, 1 Mar 2015 18:56:17 +0000 (13:56 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Sun, 1 Mar 2015 19:03:05 +0000 (14:03 -0500)
Right now we only support I420, but vpx seems to support more formats.
This will prevent hard to find bug in the future.

ext/vpx/gstvp8dec.c
ext/vpx/gstvp9dec.c

index fb6e928..67a168a 100644 (file)
@@ -384,7 +384,8 @@ gst_vp8_dec_image_to_buffer (GstVP8Dec * dec, const vpx_image_t * img,
   for (comp = 0; comp < 3; comp++) {
     dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
     src = img->planes[comp];
-    width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp);
+    width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp)
+        * GST_VIDEO_FRAME_COMP_PSTRIDE (&frame, comp);
     height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, comp);
     deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
     srcstride = img->stride[comp];
index 880c191..43c46b3 100644 (file)
@@ -381,7 +381,8 @@ gst_vp9_dec_image_to_buffer (GstVP9Dec * dec, const vpx_image_t * img,
   for (comp = 0; comp < 3; comp++) {
     dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
     src = img->planes[comp];
-    width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp);
+    width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp)
+        * GST_VIDEO_FRAME_COMP_PSTRIDE (&frame, comp);
     height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, comp);
     deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
     srcstride = img->stride[comp];