1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 (#3515)

---------

Co-authored-by: john <hondaxiao@tencent.com>
This commit is contained in:
chundonglinlin 2023-07-18 11:09:50 +08:00 committed by GitHub
parent a1c7b9f2ba
commit 3fa4f66648
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 88 additions and 5 deletions

View file

@ -880,7 +880,7 @@ srs_error_t SrsRtcRtpBuilder::init_codec(SrsAudioCodecId codec)
codec_ = new SrsAudioTranscoder();
// Initialize the codec according to the codec in stream.
int bitrate = 48000; // The output bitrate in bps.
int bitrate = _srs_config->get_rtc_opus_bitrate(req->vhost);// The output bitrate in bps.
if ((err = codec_->initialize(codec, SrsAudioCodecIdOpus, kAudioChannel, kAudioSamplerate, bitrate)) != srs_success) {
return srs_error_wrap(err, "init codec=%d", codec);
}
@ -1337,7 +1337,7 @@ srs_error_t SrsRtcFrameBuilder::initialize(SrsRequest* r)
SrsAudioCodecId to = SrsAudioCodecIdAAC; // The output audio codec.
int channels = 2; // The output audio channels.
int sample_rate = 48000; // The output audio sample rate in HZ.
int bitrate = 48000; // The output audio bitrate in bps.
int bitrate = _srs_config->get_rtc_aac_bitrate(r->vhost); // The output audio bitrate in bps.
if ((err = codec_->initialize(from, to, channels, sample_rate, bitrate)) != srs_success) {
return srs_error_wrap(err, "bridge initialize");
}