TT#31401 configure encoder bitrate

Change-Id: I96e14285b4e6235451ef55dfdfd0fec9f7364096
changes/85/18685/6
Richard Fuchs 8 years ago
parent 5c05c88ac4
commit c380052882

@ -354,7 +354,9 @@ static struct ssrc_entry *__ssrc_handler_new(void *p) {
ch->encoder = encoder_new();
if (!ch->encoder)
goto err;
if (encoder_config(ch->encoder, h->dest_pt.codec_def->avcodec_id, 0, &enc_format, &ch->encoder_format))
// XXX make bitrate configurable
if (encoder_config(ch->encoder, h->dest_pt.codec_def->avcodec_id,
h->dest_pt.codec_def->default_bitrate, &enc_format, &ch->encoder_format))
goto err;
ilog(LOG_DEBUG, "Encoder created with clockrate %i, %i channels, using sample format %i",

@ -26,34 +26,29 @@
#define CODEC_DEF_FULL(ref, codec_id, mult, name, clockrate, channels) { \
#define CODEC_DEF_FULL(ref, codec_id, mult, name, clockrate, channels, bitrate) { \
.rtpname = #ref, \
.avcodec_id = codec_id, \
.clockrate_mult = mult, \
.avcodec_name = #name, \
.default_clockrate = clockrate, \
.default_channels = channels, \
.default_bitrate = bitrate, \
}
#define CODEC_DEF_AVC(ref, id, mult, name, clockrate, channels) { \
.rtpname = #ref, \
.avcodec_id = AV_CODEC_ID_ ## id, \
.clockrate_mult = mult, \
.avcodec_name = #name, \
.default_clockrate = clockrate, \
.default_channels = channels, \
}
#define CODEC_DEF_MULT_NAME(ref, id, mult, name) CODEC_DEF_AVC(ref, id, mult, name, -1, -1)
#define CODEC_DEF_MULT_NAME_ENC(ref, id, mult, name, clockrate, channels) \
CODEC_DEF_AVC(ref, id, mult, name, clockrate, channels)
#define CODEC_DEF_AVC(ref, id, mult, name, clockrate, channels, bitrate) \
CODEC_DEF_FULL(ref, AV_CODEC_ID_ ## id, mult, name, clockrate, channels, bitrate)
#define CODEC_DEF_MULT_NAME(ref, id, mult, name) CODEC_DEF_AVC(ref, id, mult, name, -1, -1, 0)
#define CODEC_DEF_MULT_NAME_ENC(ref, id, mult, name, clockrate, channels, bitrate) \
CODEC_DEF_AVC(ref, id, mult, name, clockrate, channels, bitrate)
#define CODEC_DEF_MULT(ref, id, mult) CODEC_DEF_MULT_NAME(ref, id, mult, NULL)
#define CODEC_DEF_MULT_ENC(ref, id, mult, clockrate, channels) \
CODEC_DEF_MULT_NAME_ENC(ref, id, mult, NULL, clockrate, channels)
CODEC_DEF_MULT_NAME_ENC(ref, id, mult, NULL, clockrate, channels, 0)
#define CODEC_DEF_NAME(ref, id, name) CODEC_DEF_MULT_NAME(ref, id, 1, name)
#define CODEC_DEF_NAME_ENC(ref, id, name, clockrate, channels) \
CODEC_DEF_MULT_NAME_ENC(ref, id, 1, name, clockrate, channels)
#define CODEC_DEF_NAME_ENC(ref, id, name, clockrate, channels, bitrate) \
CODEC_DEF_MULT_NAME_ENC(ref, id, 1, name, clockrate, channels, bitrate)
#define CODEC_DEF(ref, id) CODEC_DEF_MULT(ref, id, 1)
#define CODEC_DEF_ENC(ref, id, clockrate, channels) CODEC_DEF_MULT_ENC(ref, id, 1, clockrate, channels)
#define CODEC_DEF_STUB(ref) CODEC_DEF_FULL(ref, -1, 1, ref, -1, -1)
#define CODEC_DEF_STUB(ref) CODEC_DEF_FULL(ref, -1, 1, ref, -1, -1, 0)
static const struct codec_def_s codecs[] = {
CODEC_DEF(PCMA, PCM_ALAW),
@ -65,7 +60,7 @@ static const struct codec_def_s codecs[] = {
CODEC_DEF_ENC(speex, SPEEX, 16000, 1),
CODEC_DEF(GSM, GSM),
CODEC_DEF(iLBC, ILBC),
CODEC_DEF_NAME_ENC(opus, OPUS, libopus, 48000, 2),
CODEC_DEF_NAME_ENC(opus, OPUS, libopus, 48000, 2, 24000),
CODEC_DEF_NAME(vorbis, VORBIS, libvorbis),
CODEC_DEF(ac3, AC3),
CODEC_DEF(eac3, EAC3),

@ -33,6 +33,7 @@ struct codec_def_s {
const char *avcodec_name;
const int default_clockrate;
const int default_channels;
const int default_bitrate;
};
struct format_s {

Loading…
Cancel
Save