Skip to content

Commit

Permalink
upgrade live555helper & remove obsolete patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed May 1, 2024
1 parent 8ccfd88 commit 2d09c6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 34 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")




Expand Down
35 changes: 6 additions & 29 deletions inc/liveaudiosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,24 @@ class LiveAudioSource : public webrtc::Notifier<webrtc::AudioSourceInterface>, 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<std::string, std::string> 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<webrtc::AudioCodecPairId>());
Expand Down

0 comments on commit 2d09c6e

Please sign in to comment.