1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

RTC: Support OPUS stereo SDP option. v5.0.203 (#3910)

In an SDK that supports RTC Opus stereo, the parameter "stereo=1" may
appear. SRS (Spatial Reference System) needs to handle this correctly
and return an answer to enable WebRTC stereo support.

---------

`TRANS_BY_GPT4`
This commit is contained in:
john 2023-12-14 23:31:54 +08:00
parent 52b01b14e9
commit 43d15ed3d8
4 changed files with 11 additions and 2 deletions

View file

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v5-changes"></a> <a name="v5-changes"></a>
## SRS 5.0 Changelog ## SRS 5.0 Changelog
* v5.0, 2023-12-14, Merge [#3910](https://github.com/ossrs/srs/pull/3910): RTC: Support OPUS stereo SDP option. v5.0.203 (#3910)
* v5.0, 2023-12-14, Merge [#3902](https://github.com/ossrs/srs/pull/3902): Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v5.0.202 (#3902) * v5.0, 2023-12-14, Merge [#3902](https://github.com/ossrs/srs/pull/3902): Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v5.0.202 (#3902)
* v5.0, 2023-11-22, Merge [#3891](https://github.com/ossrs/srs/pull/3891): fix 'sed' error in options.sh. v5.0.201 (#3891) * v5.0, 2023-11-22, Merge [#3891](https://github.com/ossrs/srs/pull/3891): fix 'sed' error in options.sh. v5.0.201 (#3891)
* v5.0, 2023-11-19, Merge [#3886](https://github.com/ossrs/srs/pull/3886): Change the hls_aof_ratio to 2.1. v5.0.200 (#3886) * v5.0, 2023-11-19, Merge [#3886](https://github.com/ossrs/srs/pull/3886): Change the hls_aof_ratio to 2.1. v5.0.200 (#3886)

View file

@ -1979,6 +1979,7 @@ SrsAudioPayload::SrsAudioPayload(uint8_t pt, std::string encode_name, int sample
channel_ = channel; channel_ = channel;
opus_param_.minptime = 0; opus_param_.minptime = 0;
opus_param_.use_inband_fec = false; opus_param_.use_inband_fec = false;
opus_param_.stereo = false;
opus_param_.usedtx = false; opus_param_.usedtx = false;
} }
@ -2020,6 +2021,9 @@ SrsMediaPayloadType SrsAudioPayload::generate_media_payload_type()
if (opus_param_.use_inband_fec) { if (opus_param_.use_inband_fec) {
format_specific_param << ";useinbandfec=1"; format_specific_param << ";useinbandfec=1";
} }
if (opus_param_.stereo) {
format_specific_param << ";stereo=1";
}
if (opus_param_.usedtx) { if (opus_param_.usedtx) {
format_specific_param << ";usedtx=1"; format_specific_param << ";usedtx=1";
} }
@ -2039,6 +2043,8 @@ srs_error_t SrsAudioPayload::set_opus_param_desc(std::string fmtp)
opus_param_.minptime = (int)::atol(kv[1].c_str()); opus_param_.minptime = (int)::atol(kv[1].c_str());
} else if (kv[0] == "useinbandfec") { } else if (kv[0] == "useinbandfec") {
opus_param_.use_inband_fec = (kv[1] == "1") ? true : false; opus_param_.use_inband_fec = (kv[1] == "1") ? true : false;
} else if (kv[0] == "stereo") {
opus_param_.stereo = (kv[1] == "1") ? true : false;
} else if (kv[0] == "usedtx") { } else if (kv[0] == "usedtx") {
opus_param_.usedtx = (kv[1] == "1") ? true : false; opus_param_.usedtx = (kv[1] == "1") ? true : false;
} }

View file

@ -383,11 +383,13 @@ class SrsAudioPayload : public SrsCodecPayload
{ {
int minptime; int minptime;
bool use_inband_fec; bool use_inband_fec;
bool stereo;
bool usedtx; bool usedtx;
SrsOpusParameter() { SrsOpusParameter() {
minptime = 0; minptime = 0;
use_inband_fec = false; use_inband_fec = false;
stereo = false;
usedtx = false; usedtx = false;
} }
}; };

View file

@ -1,5 +1,5 @@
// //
// Copyright (c) 2023-2023 The SRS Authors // Copyright (c) 2033-2033 The SRS Authors
// //
// SPDX-License-Identifier: MIT or MulanPSL-2.0 // SPDX-License-Identifier: MIT or MulanPSL-2.0
// //
@ -9,6 +9,6 @@
#define VERSION_MAJOR 5 #define VERSION_MAJOR 5
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 202 #define VERSION_REVISION 203
#endif #endif