diff --git a/CMakeLists.txt b/CMakeLists.txt index dea60289..76bc9b34 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,10 +84,6 @@ if (NOT EXISTS ${WEBRTCOBJS}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_ file(READ ${WEBRTCROOT}/src/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc filecontent) string(REPLACE "config.emplace()" "config.emplace(Config())" filecontent "${filecontent}") file(WRITE ${WEBRTCROOT}/src/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc "${filecontent}") - file(READ ${WEBRTCROOT}/src/build_overrides/build.gni filecontent) - string(REPLACE "enable_safe_libcxx = true\n" "enable_safe_libcxx = true\nenable_safe_libstdcxx=true\n" filecontent "${filecontent}") - file(WRITE ${WEBRTCROOT}/src/build_overrides/build.gni "${filecontent}") - diff --git a/inc/liveaudiosource.h b/inc/liveaudiosource.h index eb1d0752..fc75ca07 100644 --- a/inc/liveaudiosource.h +++ b/inc/liveaudiosource.h @@ -50,47 +50,24 @@ class LiveAudioSource : public webrtc::Notifier, p } // overide RTSPConnection::Callback - virtual bool onNewSession(const char *id, const char *media, const char *codec, const char *sdp) override + virtual bool onNewSession(const char *id, const char *media, const char *codec, const char *sdp, unsigned int rtpfrequency, unsigned int channels) override { bool success = false; if (strcmp(media, "audio") == 0) { RTC_LOG(LS_INFO) << "LiveAudioSource::onNewSession " << media << "/" << codec << " " << sdp; - // parse sdp to extract freq and channel - std::string fmt(sdp); - std::transform(fmt.begin(), fmt.end(), fmt.begin(), [](unsigned char c) { return std::tolower(c); }); - std::string codecstr(codec); - std::transform(codecstr.begin(), codecstr.end(), codecstr.begin(), [](unsigned char c) { return std::tolower(c); }); - size_t pos = fmt.find(codecstr); - if (pos != std::string::npos) - { - fmt.erase(0, pos + strlen(codec)); - fmt.erase(fmt.find_first_of(" \r\n")); - std::istringstream is(fmt); - std::string dummy; - std::getline(is, dummy, '/'); - std::string freq; - std::getline(is, freq, '/'); - if (!freq.empty()) - { - m_freq = std::stoi(freq); - } - std::string channel; - std::getline(is, channel, '/'); - if (!channel.empty()) - { - m_channel = std::stoi(channel); - } - } - RTC_LOG(LS_INFO) << "LiveAudioSource::onNewSession codec:" << codecstr << " freq:" << m_freq << " channel:" << m_channel; + m_freq = rtpfrequency; + m_channel = channels; + + RTC_LOG(LS_INFO) << "LiveAudioSource::onNewSession codec:" << " freq:" << m_freq << " channel:" << m_channel; std::map params; if (m_channel == 2) { params["stereo"] = "1"; } - webrtc::SdpAudioFormat format = webrtc::SdpAudioFormat(codecstr, m_freq, m_channel, std::move(params)); + webrtc::SdpAudioFormat format = webrtc::SdpAudioFormat(codec, m_freq, m_channel, std::move(params)); if (m_factory->IsSupportedDecoder(format)) { m_decoder = m_factory->MakeAudioDecoder(format, absl::optional()); diff --git a/live555helper b/live555helper index af76e869..834115dc 160000 --- a/live555helper +++ b/live555helper @@ -1 +1 @@ -Subproject commit af76e8693cd13ee3f6d8a030616daba6ae873503 +Subproject commit 834115dc53fea5c9ce0121374874ab05bc472d60