The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / ffmpeg / 0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch
1 From 939ebbbc46ca9995637415594f1815633587104f Mon Sep 17 00:00:00 2001
2 From: marc <mhocking@ubuntu-desktop.(none)>
3 Date: Mon, 18 Feb 2013 17:18:18 +0000
4 Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start
5  with an I-Frame.
6
7 Patch part of the XBMC patch set for ffmpeg, downloaded from
8 https://github.com/xbmc/FFmpeg/.
9
10 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
11 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
12 ---
13  libavcodec/dxva2_h264.c | 8 ++++++++
14  libavcodec/h264.c       | 1 +
15  libavcodec/h264.h       | 2 ++
16  libavcodec/h264_slice.c | 1 +
17  4 files changed, 12 insertions(+)
18
19 diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
20 index 6deccc3..85b25fd 100644
21 --- a/libavcodec/dxva2_h264.c
22 +++ b/libavcodec/dxva2_h264.c
23 @@ -451,6 +451,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
24  
25      if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
26          return -1;
27 +
28 +    // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
29 +    if (!h->got_first_iframe) {
30 +        if (!(ctx_pic->pp.wBitFields & (1 << 15)))
31 +            return -1;
32 +        h->got_first_iframe = 1;
33 +    }
34 +
35      ret = ff_dxva2_common_end_frame(avctx, &h->cur_pic_ptr->f,
36                                      &ctx_pic->pp, sizeof(ctx_pic->pp),
37                                      &ctx_pic->qm, sizeof(ctx_pic->qm),
38 diff --git a/libavcodec/h264.c b/libavcodec/h264.c
39 index 222bf58..ea2ec17 100644
40 --- a/libavcodec/h264.c
41 +++ b/libavcodec/h264.c
42 @@ -1085,6 +1085,7 @@ void ff_h264_flush_change(H264Context *h)
43      h->list_count = 0;
44      h->current_slice = 0;
45      h->mmco_reset = 1;
46 +    h->got_first_iframe = 0;
47  }
48  
49  /* forget old pics after a seek */
50 diff --git a/libavcodec/h264.h b/libavcodec/h264.h
51 index b94f06b..bc9458b 100644
52 --- a/libavcodec/h264.h
53 +++ b/libavcodec/h264.h
54 @@ -741,6 +741,8 @@ typedef struct H264Context {
55      int luma_weight_flag[2];    ///< 7.4.3.2 luma_weight_lX_flag
56      int chroma_weight_flag[2];  ///< 7.4.3.2 chroma_weight_lX_flag
57  
58 +    int got_first_iframe;
59 +
60      // Timestamp stuff
61      int sei_buffering_period_present;   ///< Buffering period SEI flag
62      int initial_cpb_removal_delay[32];  ///< Initial timestamps for CPBs
63 diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
64 index 53f61ca..b171d78 100644
65 --- a/libavcodec/h264_slice.c
66 +++ b/libavcodec/h264_slice.c
67 @@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
68          ff_h264_free_tables(h, 0);
69      h->first_field           = 0;
70      h->prev_interlaced_frame = 1;
71 +    h->got_first_iframe = 0;
72  
73      init_scan_tables(h);
74      ret = ff_h264_alloc_tables(h);
75 -- 
76 2.1.0
77