[FFmpeg-devel] [PATCH] sdp: optional 'vbr' parameter for Speex RTP payload

Michael Niedermayer michaelni at gmx.at
Tue Oct 9 22:50:33 CEST 2012


On Tue, Oct 09, 2012 at 11:09:00PM +0400, Dmitry Samonenko wrote:
> Hello.
> 
> Please, take a look at the provided patch.
> 
> I'm concerned with av_opt_get_int in coditional expression. Feels like
> vad option should be converted to AV_OPT_TYPE_FLAG, so condition could
> benefit from simple av_opt_flag_is_set and get rid of local variable.
> 
> However, this option type is almost never used - either it's relatively
> new or there are some drawbacks
> (AV_OPT_TYPE_INT is used much more extensively for [0;1] range).

>  sdp.c |   19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 9e11c5478da14c0901d1f0a696ae9bccd7bfafdc  0001-sdp-optional-vbr-parameter-is-added-for-speex-payloa.patch
> From 5f3c54214a6ca702229b5e5f1006e114447a539e Mon Sep 17 00:00:00 2001
> From: Dmitry Samonenko <shreddingwork at gmail.com>
> Date: Tue, 9 Oct 2012 22:47:38 +0400
> Subject: [PATCH 1/1] sdp: optional 'vbr' parameter is added for speex payload
>  case
> 
> ---
>  libavformat/sdp.c |   19 ++++++++++++++++---
>  1 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/sdp.c b/libavformat/sdp.c
> index 30941b7..0beba0a 100644
> --- a/libavformat/sdp.c
> +++ b/libavformat/sdp.c
> @@ -572,10 +572,23 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
>                                       payload_type, c->sample_rate,
>                                       payload_type, c->block_align == 38 ? 20 : 30);
>              break;
> -        case AV_CODEC_ID_SPEEX:
> -            av_strlcatf(buff, size, "a=rtpmap:%d speex/%d\r\n",
> -                                     payload_type, c->sample_rate);
> +        case AV_CODEC_ID_SPEEX: {
> +            const char *mode;
> +            uint64_t vad_option;
> +
> +            if (fmt->flags & CODEC_FLAG_QSCALE)
> +                mode = "on";
> +            else if (!av_opt_get_int(c, "vad", AV_OPT_FLAG_ENCODING_PARAM, &vad_option) && vad_option)
> +                mode = "vad";
> +            else
> +                mode = "off";

I dont think this will work with stream copy, that is for example
something like:

ffmpeg -i test.mov -acodec copy -f rtp rtp://127.0.0.1:1234
the mov file here would contain a speex stream

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121009/72834192/attachment.asc>


More information about the ffmpeg-devel mailing list