mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
libavformat: Set the default for the max_delay option to -1
Make the muxers/demuxers that use the field handle the default -1 in the same way as 0. This allows distinguishing an intentionally set 0 from the default value where the user hasn't set it. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
0d0b81f941
commit
4fa57d524f
@ -318,6 +318,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
|
||||
s->packet_size = ctx->packet_size;
|
||||
} else
|
||||
s->packet_size = 2048;
|
||||
if (ctx->max_delay < 0) /* Not set by the caller */
|
||||
ctx->max_delay = 0;
|
||||
|
||||
s->vcd_padding_bytes_written = 0;
|
||||
s->vcd_padding_bitrate=0;
|
||||
|
@ -460,6 +460,9 @@ static int mpegts_write_header(AVFormatContext *s)
|
||||
const char *provider_name;
|
||||
int *pids;
|
||||
|
||||
if (s->max_delay < 0) /* Not set by the caller */
|
||||
s->max_delay = 0;
|
||||
|
||||
// round up to a whole number of TS packets
|
||||
ts->pes_payload_size = (ts->pes_payload_size + 14 + 183) / 184 * 184 - 14;
|
||||
|
||||
|
@ -41,7 +41,7 @@ static const AVOption options[]={
|
||||
{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.dbl = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */
|
||||
{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
|
||||
{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
|
||||
{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
|
||||
{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, E|D},
|
||||
{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
|
||||
/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
|
||||
* to be removed when avconv is fixed */
|
||||
|
@ -126,7 +126,7 @@ static int rtp_write_header(AVFormatContext *s1)
|
||||
s->max_payload_size = s1->packet_size - 12;
|
||||
|
||||
s->max_frames_per_packet = 0;
|
||||
if (s1->max_delay) {
|
||||
if (s1->max_delay > 0) {
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
int frame_size = av_get_audio_frame_duration(st->codec, 0);
|
||||
if (!frame_size)
|
||||
|
@ -1426,6 +1426,9 @@ int ff_rtsp_connect(AVFormatContext *s)
|
||||
if (!ff_network_init())
|
||||
return AVERROR(EIO);
|
||||
|
||||
if (s->max_delay < 0) /* Not set by the caller */
|
||||
s->max_delay = 0;
|
||||
|
||||
rt->control_transport = RTSP_MODE_PLAIN;
|
||||
if (rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_HTTP)) {
|
||||
rt->lower_transport_mask = 1 << RTSP_LOWER_TRANSPORT_TCP;
|
||||
@ -1866,6 +1869,9 @@ static int sdp_read_header(AVFormatContext *s)
|
||||
if (!ff_network_init())
|
||||
return AVERROR(EIO);
|
||||
|
||||
if (s->max_delay < 0) /* Not set by the caller */
|
||||
s->max_delay = 0;
|
||||
|
||||
/* read the whole sdp file */
|
||||
/* XXX: better loading */
|
||||
content = av_malloc(SDP_MAX_SIZE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user