ffmpeg | branch: master | Rainer Hochecker <fernetme...@online.de> | Thu Apr  2 
13:43:06 2015 +0200| [3e53211a578fc6b042ceff45b2702335294e0464] | committer: 
Michael Niedermayer

vda: fix h264 decoding for avcC,vda wants the entire buffer

Signed-off-by: Michael Niedermayer <michae...@gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e53211a578fc6b042ceff45b2702335294e0464
---

 libavcodec/h264.c     |    2 +-
 libavcodec/vda_h264.c |   20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 05d238b..1c990c3 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1588,7 +1588,7 @@ again:
                         decode_postinit(h, nal_index >= nals_needed);
 
                     if (h->avctx->hwaccel &&
-                        (ret = h->avctx->hwaccel->start_frame(h->avctx, NULL, 
0)) < 0)
+                        (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, 
buf_size)) < 0)
                         return ret;
                     if (CONFIG_H264_VDPAU_DECODER &&
                         h->avctx->codec->capabilities & 
CODEC_CAP_HWACCEL_VDPAU)
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index 081c366..b6b9ab4 100644
--- a/libavcodec/vda_h264.c
+++ b/libavcodec/vda_h264.c
@@ -320,9 +320,20 @@ static int vda_h264_start_frame(AVCodecContext *avctx,
                                 uint32_t size)
 {
     VDAContext *vda = avctx->internal->hwaccel_priv_data;
-
-    vda->bitstream_size = 0;
-
+    H264Context *h  = avctx->priv_data;
+
+    if (h->is_avc == 1) {
+        void *tmp;
+        vda->bitstream_size = 0;
+        tmp = av_fast_realloc(vda->bitstream,
+                              &vda->allocated_size,
+                              size);
+        vda->bitstream = tmp;
+        memcpy(vda->bitstream, buffer, size);
+        vda->bitstream_size = size;
+    } else {
+        vda->bitstream_size = 0;
+    }
     return 0;
 }
 
@@ -333,6 +344,9 @@ static int vda_h264_decode_slice(AVCodecContext *avctx,
     VDAContext *vda       = avctx->internal->hwaccel_priv_data;
     void *tmp;
 
+    if (h->is_avc == 1)
+        return 0;
+
     tmp = av_fast_realloc(vda->bitstream,
                           &vda->allocated_size,
                           vda->bitstream_size + size + 4);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to