[vlc-commits] avcodec: remove impossible errors
Rémi Denis-Courmont
git at videolan.org
Wed Apr 22 20:46:11 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 22 20:05:04 2015 +0300| [eaf804180778f944363fba5e98604d01b0c00a2c] | committer: Rémi Denis-Courmont
avcodec: remove impossible errors
The decoder downstream is not allowed to return smaller pictures than
requested. Only alignment can still potentially be an issue.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eaf804180778f944363fba5e98604d01b0c00a2c
---
modules/codec/avcodec/video.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index ccd179f..db20e25 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1005,32 +1005,19 @@ static picture_t *lavc_dr_GetFrame(struct AVCodecContext *ctx,
if (ctx->pix_fmt == PIX_FMT_PAL8)
return NULL;
+ picture_t *pic = ffmpeg_NewPictBuf(dec, ctx);
+ if (pic == NULL)
+ return NULL;
+
int width = frame->width;
int height = frame->height;
int aligns[AV_NUM_DATA_POINTERS];
avcodec_align_dimensions2(ctx, &width, &height, aligns);
- picture_t *pic = ffmpeg_NewPictBuf(dec, ctx);
- if (pic == NULL)
- return NULL;
-
/* Check that the picture is suitable for libavcodec */
- if (pic->p[0].i_pitch < width * pic->p[0].i_pixel_pitch)
- {
- if (sys->i_direct_rendering_used != 0)
- msg_Dbg(dec, "plane 0: pitch too small (%d/%d*%d)",
- pic->p[0].i_pitch, width, pic->p[0].i_pixel_pitch);
- goto no_dr;
- }
-
- if (pic->p[0].i_lines < height)
- {
- if (sys->i_direct_rendering_used != 0)
- msg_Dbg(dec, "plane 0: lines too few (%d/%d)",
- pic->p[0].i_lines, height);
- goto no_dr;
- }
+ assert(pic->p[0].i_pitch >= width * pic->p[0].i_pixel_pitch);
+ assert(pic->p[0].i_lines >= height);
for (int i = 0; i < pic->i_planes; i++)
{
More information about the vlc-commits
mailing list