On date Tuesday 2011-04-26 19:20:46 +0200, Reimar Döffinger encoded:
> On Tue, Apr 26, 2011 at 11:53:25AM +0200, Stefano Sabatini wrote:
> > Also remove unnecessary call to avctx->release_buffer(). reget_buffer
> > is required since apparently the coded needs to be passed the previous
> > frame data again.
>
> If that is correct
>
> > p->reference= 0;
> > - if(avctx->get_buffer(avctx, p) < 0){
> > - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> > + if (avctx->reget_buffer(avctx, p) < 0) {
>
> This can't work.
> Setting reference=0 means (I think) e.g. it is ok for libavfilter to
> just draw an OSD directly on the frame instead of making a copy.
> Or to say it differently: Always using reference = 0 and reget_buffer together
> make no sense.
So may naive fix is: force reference to 1, so application/libavfilter
will preserve the frame and it can be requested again unmodified via
reget_buffer() (but it's hard to say if the fix is correct without a
more deep knowledge of the codec).
Adding libav-devel to recipients.
--
FFmpeg = Friendly Fascinating Mortal Puritan Elfic Gorilla
>From d9cb4f0e13d80a1d19ca64004c7645b43bc3fdb9 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <[email protected]>
Date: Tue, 26 Apr 2011 11:51:50 +0200
Subject: [PATCH] qpeg: use reget_buffer() in decode_frame()
reget_buffer is required since apparently the codec needs to be feeded
with the previous frame data. Also remove call to
avctx->release_buffer(), which was preventing reget_buffer() to get
the previous frame data.
Releasing the frame and using get_buffer() was working only in the case
get_buffer() was returning the old frame data again, and resulting in
playback artifacts otherwise.
This also set frame->reference to 1, as the frame will be requested
unmodified later so it shouldn't be modified by the application.
Fix playback of file Clock.avi, trac issue #79.
---
libavcodec/qpeg.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index dda5525..df0b326 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -259,12 +259,9 @@ static int decode_frame(AVCodecContext *avctx,
int delta;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
- if(p->data[0])
- avctx->release_buffer(avctx, p);
-
- p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ p->reference = 1;
+ if (avctx->reget_buffer(avctx, p) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
outdata = a->pic.data[0];
--
1.7.2.3
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel