From b363d4a1032733d64b8e7068176ee7dcea49e5ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 25 Jan 2012 18:24:07 +0100 Subject: [PATCH] theoraenc: Fix encoding of non-mod-16 widths/heights The next higher multiple of 16 has to be passed in the input buffers but Theora does never read beyond the configured picture size. --- ext/theora/gsttheoraenc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 00ecd69..2406779 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -1057,6 +1057,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp, static void theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame) { + GstVideoInfo info; guint i; /* According to Theora developer Timothy Terriberry, the Theora @@ -1066,9 +1067,15 @@ theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame) * Due to this, setting the frame's width/height as the buffer width/height * is perfectly ok, even though it does not strictly look ok. */ + + gst_video_info_init (&info); + gst_video_info_set_format (&info, GST_VIDEO_FRAME_FORMAT (frame), + GST_ROUND_UP_16 (GST_VIDEO_FRAME_WIDTH (frame)), + GST_ROUND_UP_16 (GST_VIDEO_FRAME_HEIGHT (frame))); + for (i = 0; i < 3; i++) { - buf[i].width = GST_VIDEO_FRAME_COMP_WIDTH (frame, i); - buf[i].height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, i); + buf[i].width = GST_VIDEO_INFO_COMP_WIDTH (&info, i); + buf[i].height = GST_VIDEO_INFO_COMP_HEIGHT (&info, i); buf[i].data = GST_VIDEO_FRAME_COMP_DATA (frame, i); buf[i].stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, i); } -- 2.7.4