Skip to content

Commit

Permalink
fix build with latest webrtc sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Sep 7, 2024
1 parent 4cfa382 commit d97b7ad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion inc/EncodedVideoFrameBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class EncodedVideoFrameBuffer : public webrtc::VideoFrameBuffer
webrtc::EncodedImage encoded_image;
encoded_image.SetEncodedData(webrtc::EncodedImageBuffer::Create(m_encoded_data->data(), m_encoded_data->size()));
encoded_image._frameType = m_frameType;
encoded_image.SetAtTargetQuality(true);
encoded_image.SetRtpTimestamp(rtptime);
encoded_image.ntp_time_ms_ = ntptime;
return encoded_image;
Expand Down
5 changes: 4 additions & 1 deletion inc/liveaudiosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "environment.h"

#include "pc/local_audio_source.h"
#include "api/environment/environment_factory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"

template <typename T>
Expand Down Expand Up @@ -70,7 +71,7 @@ class LiveAudioSource : public webrtc::Notifier<webrtc::AudioSourceInterface>, p
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>());
m_decoder = m_factory->Create(m_webrtcenv, format, std::optional<webrtc::AudioCodecPairId>());
m_codec[id] = codec;
success = true;
}
Expand Down Expand Up @@ -164,6 +165,7 @@ class LiveAudioSource : public webrtc::Notifier<webrtc::AudioSourceInterface>, p
LiveAudioSource(rtc::scoped_refptr<webrtc::AudioDecoderFactory> audioDecoderFactory, const std::string &uri, const std::map<std::string, std::string> &opts, bool wait)
: m_env(m_stop)
, m_connection(m_env, this, uri.c_str(), opts, rtc::LogMessage::GetLogToDebug() <= 2)
, m_webrtcenv(webrtc::CreateEnvironment())
, m_factory(audioDecoderFactory)
, m_freq(8000)
, m_channel(1)
Expand All @@ -185,6 +187,7 @@ class LiveAudioSource : public webrtc::Notifier<webrtc::AudioSourceInterface>, p

private:
T m_connection;
const webrtc::Environment m_webrtcenv;
std::thread m_capturethread;
rtc::scoped_refptr<webrtc::AudioDecoderFactory> m_factory;
std::unique_ptr<webrtc::AudioDecoder> m_decoder;
Expand Down
4 changes: 2 additions & 2 deletions inc/livevideosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class LiveVideoSource : public VideoDecoder, public T::Callback
m_cfg.clear();
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);

absl::optional<webrtc::SpsParser::SpsState> sps = webrtc::SpsParser::ParseSps(buffer + index.payload_start_offset + webrtc::H264::kNaluTypeSize, index.payload_size - webrtc::H264::kNaluTypeSize);
std::optional<webrtc::SpsParser::SpsState> sps = webrtc::SpsParser::ParseSps(buffer + index.payload_start_offset + webrtc::H264::kNaluTypeSize, index.payload_size - webrtc::H264::kNaluTypeSize);
if (!sps)
{
RTC_LOG(LS_ERROR) << "cannot parse sps";
Expand Down Expand Up @@ -179,7 +179,7 @@ class LiveVideoSource : public VideoDecoder, public T::Callback
RTC_LOG(LS_VERBOSE) << "LiveVideoSource:onData SPS";
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);

absl::optional<webrtc::H265SpsParser::SpsState> sps = webrtc::H265SpsParser::ParseSps(buffer + index.payload_start_offset + webrtc::H265::kNaluHeaderSize, index.payload_size - webrtc::H265::kNaluHeaderSize);
std::optional<webrtc::H265SpsParser::SpsState> sps = webrtc::H265SpsParser::ParseSps(buffer + index.payload_start_offset + webrtc::H265::kNaluHeaderSize, index.payload_size - webrtc::H265::kNaluHeaderSize);
if (!sps)
{
RTC_LOG(LS_ERROR) << "cannot parse sps";
Expand Down
6 changes: 3 additions & 3 deletions src/PeerConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,9 +1257,9 @@ bool PeerConnectionManager::AddStreams(webrtc::PeerConnectionInterface *peer_con
int bitrate = std::stoi(opts.at("bitrate"));

webrtc::BitrateSettings bitrateParam;
bitrateParam.min_bitrate_bps = absl::optional<int>(bitrate / 2);
bitrateParam.start_bitrate_bps = absl::optional<int>(bitrate);
bitrateParam.max_bitrate_bps = absl::optional<int>(bitrate * 2);
bitrateParam.min_bitrate_bps = std::optional<int>(bitrate / 2);
bitrateParam.start_bitrate_bps = std::optional<int>(bitrate);
bitrateParam.max_bitrate_bps = std::optional<int>(bitrate * 2);
peer_connection->SetBitrate(bitrateParam);

RTC_LOG(LS_WARNING) << "set bitrate:" << bitrate;
Expand Down

0 comments on commit d97b7ad

Please sign in to comment.