Originally committed as revision 920 to svn://svn.ffmpeg.org/ffmpeg/trunk
Philip Gladstone authored on 2002/09/12 11:31:11... | ... |
@@ -325,6 +325,16 @@ static int compute_datarate(DataRateData *drd, INT64 count) |
325 | 325 |
return ((count - drd->count1) * 1000) / (cur_time - drd->time1); |
326 | 326 |
} |
327 | 327 |
|
328 |
+static int get_longterm_datarate(DataRateData *drd, INT64 count) |
|
329 |
+{ |
|
330 |
+ /* You get the first 3 seconds flat out */ |
|
331 |
+ if (cur_time - drd->time1 < 3000) |
|
332 |
+ return 0; |
|
333 |
+ |
|
334 |
+ return compute_datarate(drd, count); |
|
335 |
+} |
|
336 |
+ |
|
337 |
+ |
|
328 | 338 |
static void start_children(FFStream *feed) |
329 | 339 |
{ |
330 | 340 |
if (no_launch) |
... | ... |
@@ -1936,6 +1946,11 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) |
1936 | 1936 |
|
1937 | 1937 |
static int compute_send_delay(HTTPContext *c) |
1938 | 1938 |
{ |
1939 |
+ int datarate = 8 * get_longterm_datarate(&c->datarate, c->data_count); |
|
1940 |
+ |
|
1941 |
+ if (datarate > c->bandwidth * 2000) { |
|
1942 |
+ return 1000; |
|
1943 |
+ } |
|
1939 | 1944 |
return 0; |
1940 | 1945 |
} |
1941 | 1946 |
|
... | ... |
@@ -2010,7 +2025,7 @@ static int http_prepare_data(HTTPContext *c) |
2010 | 2010 |
/* We have timed out */ |
2011 | 2011 |
c->state = HTTPSTATE_SEND_DATA_TRAILER; |
2012 | 2012 |
} else { |
2013 |
- if (c->is_packetized) { |
|
2013 |
+ if (1 || c->is_packetized) { |
|
2014 | 2014 |
if (compute_send_delay(c) > 0) { |
2015 | 2015 |
c->state = HTTPSTATE_WAIT; |
2016 | 2016 |
return 1; /* state changed */ |
... | ... |
@@ -3278,6 +3293,16 @@ void add_codec(FFStream *stream, AVCodecContext *av) |
3278 | 3278 |
av->qcompress = 0.5; |
3279 | 3279 |
av->qblur = 0.5; |
3280 | 3280 |
|
3281 |
+ if (!av->rc_eq) |
|
3282 |
+ av->rc_eq = "tex^qComp"; |
|
3283 |
+ if (!av->i_quant_factor) |
|
3284 |
+ av->i_quant_factor = 0.8; |
|
3285 |
+ if (!av->b_quant_factor) |
|
3286 |
+ av->b_quant_factor = 1.25; |
|
3287 |
+ if (!av->b_quant_offset) |
|
3288 |
+ av->b_quant_offset = 1.25; |
|
3289 |
+ |
|
3290 |
+ |
|
3281 | 3291 |
break; |
3282 | 3292 |
default: |
3283 | 3293 |
av_abort(); |
... | ... |
@@ -3705,6 +3730,7 @@ int parse_ffconfig(const char *filename) |
3705 | 3705 |
video_enc.flags |= CODEC_FLAG_HQ; |
3706 | 3706 |
} |
3707 | 3707 |
} else if (!strcasecmp(cmd, "VideoQDiff")) { |
3708 |
+ get_arg(arg, sizeof(arg), &p); |
|
3708 | 3709 |
if (stream) { |
3709 | 3710 |
video_enc.max_qdiff = atoi(arg); |
3710 | 3711 |
if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) { |
... | ... |
@@ -3714,6 +3740,7 @@ int parse_ffconfig(const char *filename) |
3714 | 3714 |
} |
3715 | 3715 |
} |
3716 | 3716 |
} else if (!strcasecmp(cmd, "VideoQMax")) { |
3717 |
+ get_arg(arg, sizeof(arg), &p); |
|
3717 | 3718 |
if (stream) { |
3718 | 3719 |
video_enc.qmax = atoi(arg); |
3719 | 3720 |
if (video_enc.qmax < 1 || video_enc.qmax > 31) { |
... | ... |
@@ -3723,6 +3750,7 @@ int parse_ffconfig(const char *filename) |
3723 | 3723 |
} |
3724 | 3724 |
} |
3725 | 3725 |
} else if (!strcasecmp(cmd, "VideoQMin")) { |
3726 |
+ get_arg(arg, sizeof(arg), &p); |
|
3726 | 3727 |
if (stream) { |
3727 | 3728 |
video_enc.qmin = atoi(arg); |
3728 | 3729 |
if (video_enc.qmin < 1 || video_enc.qmin > 31) { |