aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/ffmpeg/ffmpeg-23181.diff
blob: 5f9eceaa7d9ed1bf58744ba27f3f791f13551f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Index: libavcodec/libx264.c
===================================================================
--- libavcodec/libx264.c	(revision 23181)
+++ libavcodec/libx264.c	(working copy)
@@ -99,15 +99,17 @@
         }
 
         x4->pic.i_pts  = frame->pts;
-        x4->pic.i_type = X264_TYPE_AUTO;
+        x4->pic.i_type = frame->key_frame ? X264_TYPE_IDR : X264_TYPE_AUTO;
     }
 
+    do {
     if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
         return -1;
 
     bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
     if (bufsize < 0)
         return -1;
+    } while(!bufsize && !frame && x264_encoder_delayed_frames(x4->enc));
 
     /* FIXME: libx264 now provides DTS, but AVFrame doesn't have a field for it. */
     x4->out_pic.pts = pic_out.i_pts;
@@ -156,7 +158,7 @@
     x4->params.p_log_private        = avctx;
 
     x4->params.i_keyint_max         = avctx->gop_size;
-    x4->params.b_intra_refresh      = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
+    x4->params.b_intra_refresh      = 1; /* avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH; */
     x4->params.rc.i_bitrate         = avctx->bit_rate       / 1000;
     x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
     x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate    / 1000;
@@ -173,7 +175,7 @@
             x4->params.rc.i_qp_constant = avctx->cqp;
         }
     }
-
+    
     // if neither crf nor cqp modes are selected we have to enable the RC
     // we do it this way because we cannot check if the bitrate has been set
     if (!(avctx->crf || (avctx->cqp > -1)))
@@ -186,7 +188,7 @@
     x4->params.i_bframe_pyramid  = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
     avctx->has_b_frames          = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!avctx->max_b_frames;
 
-    x4->params.i_keyint_min = avctx->keyint_min;
+    x4->params.i_keyint_min = 0; /* avctx->keyint_min; */
     if (x4->params.i_keyint_min > x4->params.i_keyint_max)
         x4->params.i_keyint_min = x4->params.i_keyint_max;
 
@@ -293,6 +295,13 @@
 
     if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
         x4->params.b_repeat_headers = 0;
+    
+    /* zero latency */
+    x4->params.rc.i_lookahead = 0;
+    x4->params.i_sync_lookahead = 0;
+    x4->params.i_bframe = 0;
+    x4->params.b_sliced_threads = 1;
+    x4->params.b_vfr_input = 0;
 
     x4->enc = x264_encoder_open(&x4->params);
     if (!x4->enc)
@@ -313,7 +322,7 @@
         avctx->extradata      = av_malloc(s);
         avctx->extradata_size = encode_nals(avctx, avctx->extradata, s, nal, nnal, 1);
     }
-
+    
     return 0;
 }

Index: libavcodec/ituh263enc.c
===================================================================
--- libavcodec/ituh263enc.c (révision 23181)
+++ libavcodec/ituh263enc.c (copie de travail)
@@ -162,7 +162,7 @@
 
         put_bits(&s->pb, 3, 7);
         put_bits(&s->pb,3,ufep); /* Update Full Extended PTYPE */
-        if (format == 7)
+        if (format == 8)
             put_bits(&s->pb,3,6); /* Custom Source Format */
         else
             put_bits(&s->pb, 3, format);
@@ -192,7 +192,7 @@
         /* This should be here if PLUSPTYPE */
         put_bits(&s->pb, 1, 0); /* Continuous Presence Multipoint mode: off */
 
-                if (format == 7) {
+                if (format == 8) {
             /* Custom Picture Format (CPFMT) */
             s->aspect_ratio_info= ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);