Bug 1766646 - Vendor libwebrtc from df209e797b

Upstream commit: https://webrtc.googlesource.com/src/+/df209e797b6dd6d9472a63189bc8681d947725ef
    Avoid more usage of implicit conversion from scoped_refptr<T> to T*

    Update api/, call/, examples/ and rtc_tools/.

    Bug: webrtc:13464
    Change-Id: I7b0008cca68c579e89b45527a45300d1e67c3483
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260000
    Reviewed-by: Henrik Boström <hbos@webrtc.org>
    Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
    Commit-Queue: Niels Moller <nisse@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#36673}
This commit is contained in:
Michael Froman 2022-07-14 10:06:38 -05:00 коммит произвёл Connor Sheehan
Родитель 387440af68
Коммит 7d716ff9d5
12 изменённых файлов: 49 добавлений и 47 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -13557,3 +13557,6 @@ d8e84b1ab1
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
e7d998cb64
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
df209e797b

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -9050,3 +9050,5 @@ libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwe
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-07-14T15:05:12.531397.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-07-14T15:05:53.022146.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-07-14T15:06:33.632259.

Просмотреть файл

@ -203,7 +203,7 @@ void VideoEncoderSoftwareFallbackWrapperTestBase::EncodeFrame(
int expected_ret) {
rtc::scoped_refptr<I420Buffer> buffer =
I420Buffer::Create(codec_.width, codec_.height);
I420Buffer::SetBlack(buffer);
I420Buffer::SetBlack(buffer.get());
std::vector<VideoFrameType> types(1, VideoFrameType::kVideoFrameKey);
frame_ =

Просмотреть файл

@ -79,7 +79,7 @@ std::string VideoEncoderConfig::ToString() const {
break;
}
ss << ", encoder_specific_settings: ";
ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
ss << (encoder_specific_settings != nullptr ? "(ptr)" : "NULL");
ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
ss << '}';

Просмотреть файл

@ -113,7 +113,7 @@ void ResourceAdaptationProcessor::AddResource(
<< "Resource \"" << resource->Name() << "\" was already registered.";
resources_.push_back(resource);
}
resource->SetResourceListener(resource_listener_delegate_);
resource->SetResourceListener(resource_listener_delegate_.get());
RTC_LOG(LS_INFO) << "Registered resource \"" << resource->Name() << "\".";
}

Просмотреть файл

@ -170,7 +170,7 @@ void AndroidCallClient::CreatePeerConnectionFactory() {
RTC_LOG(LS_INFO) << "Media engine created: " << pcf_deps.media_engine.get();
pcf_ = CreateModularPeerConnectionFactory(std::move(pcf_deps));
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << pcf_;
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << pcf_.get();
}
void AndroidCallClient::CreatePeerConnection() {
@ -184,13 +184,13 @@ void AndroidCallClient::CreatePeerConnection() {
webrtc::PeerConnectionDependencies deps(pc_observer_.get());
pc_ = pcf_->CreatePeerConnectionOrError(config, std::move(deps)).MoveValue();
RTC_LOG(LS_INFO) << "PeerConnection created: " << pc_;
RTC_LOG(LS_INFO) << "PeerConnection created: " << pc_.get();
rtc::scoped_refptr<webrtc::VideoTrackInterface> local_video_track =
pcf_->CreateVideoTrack("video", video_source_);
rtc::scoped_refptr<webrtc::VideoTrackInterface> local_video_track(
pcf_->CreateVideoTrack("video", video_source_.get()));
local_video_track->AddOrUpdateSink(local_sink_.get(), rtc::VideoSinkWants());
pc_->AddTransceiver(local_video_track);
RTC_LOG(LS_INFO) << "Local video sink set up: " << local_video_track;
RTC_LOG(LS_INFO) << "Local video sink set up: " << local_video_track.get();
for (const rtc::scoped_refptr<webrtc::RtpTransceiverInterface>& tranceiver :
pc_->GetTransceivers()) {
@ -200,7 +200,7 @@ void AndroidCallClient::CreatePeerConnection() {
track->kind() == webrtc::MediaStreamTrackInterface::kVideoKind) {
static_cast<webrtc::VideoTrackInterface*>(track.get())
->AddOrUpdateSink(remote_sink_.get(), rtc::VideoSinkWants());
RTC_LOG(LS_INFO) << "Remote video sink set up: " << track;
RTC_LOG(LS_INFO) << "Remote video sink set up: " << track.get();
break;
}
}
@ -208,7 +208,7 @@ void AndroidCallClient::CreatePeerConnection() {
void AndroidCallClient::Connect() {
webrtc::MutexLock lock(&pc_mutex_);
pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_),
pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_).get(),
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
}
@ -258,7 +258,7 @@ void CreateOfferObserver::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
// Ownership of desc was transferred to us, now we transfer it forward.
pc_->SetLocalDescription(
rtc::make_ref_counted<SetLocalSessionDescriptionObserver>(), desc);
rtc::make_ref_counted<SetLocalSessionDescriptionObserver>().get(), desc);
// Generate a fake answer.
std::unique_ptr<webrtc::SessionDescriptionInterface> answer(

Просмотреть файл

@ -50,10 +50,9 @@ class SetRemoteSessionDescriptionObserver : public webrtc::SetRemoteDescriptionO
void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override;
};
class SetLocalSessionDescriptionObserver : public webrtc::SetSessionDescriptionObserver {
class SetLocalSessionDescriptionObserver : public webrtc::SetLocalDescriptionObserverInterface {
public:
void OnSuccess() override;
void OnFailure(webrtc::RTCError error) override;
void OnSetLocalDescriptionComplete(webrtc::RTCError error) override;
};
} // namespace
@ -134,7 +133,7 @@ void ObjCCallClient::CreatePeerConnectionFactory() {
dependencies.event_log_factory =
std::make_unique<webrtc::RtcEventLogFactory>(dependencies.task_queue_factory.get());
pcf_ = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << pcf_;
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << pcf_.get();
}
void ObjCCallClient::CreatePeerConnection() {
@ -147,12 +146,12 @@ void ObjCCallClient::CreatePeerConnection() {
pcf_->SetOptions(options);
webrtc::PeerConnectionDependencies pc_dependencies(pc_observer_.get());
pc_ = pcf_->CreatePeerConnectionOrError(config, std::move(pc_dependencies)).MoveValue();
RTC_LOG(LS_INFO) << "PeerConnection created: " << pc_;
RTC_LOG(LS_INFO) << "PeerConnection created: " << pc_.get();
rtc::scoped_refptr<webrtc::VideoTrackInterface> local_video_track =
pcf_->CreateVideoTrack("video", video_source_);
pcf_->CreateVideoTrack("video", video_source_.get());
pc_->AddTransceiver(local_video_track);
RTC_LOG(LS_INFO) << "Local video sink set up: " << local_video_track;
RTC_LOG(LS_INFO) << "Local video sink set up: " << local_video_track.get();
for (const rtc::scoped_refptr<webrtc::RtpTransceiverInterface>& tranceiver :
pc_->GetTransceivers()) {
@ -160,7 +159,7 @@ void ObjCCallClient::CreatePeerConnection() {
if (track && track->kind() == webrtc::MediaStreamTrackInterface::kVideoKind) {
static_cast<webrtc::VideoTrackInterface*>(track.get())
->AddOrUpdateSink(remote_sink_.get(), rtc::VideoSinkWants());
RTC_LOG(LS_INFO) << "Remote video sink set up: " << track;
RTC_LOG(LS_INFO) << "Remote video sink set up: " << track.get();
break;
}
}
@ -168,7 +167,7 @@ void ObjCCallClient::CreatePeerConnection() {
void ObjCCallClient::Connect() {
webrtc::MutexLock lock(&pc_mutex_);
pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_),
pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_).get(),
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
}
@ -214,7 +213,8 @@ void CreateOfferObserver::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
RTC_LOG(LS_INFO) << "Created offer: " << sdp;
// Ownership of desc was transferred to us, now we transfer it forward.
pc_->SetLocalDescription(rtc::make_ref_counted<SetLocalSessionDescriptionObserver>(), desc);
pc_->SetLocalDescription(absl::WrapUnique(desc),
rtc::make_ref_counted<SetLocalSessionDescriptionObserver>());
// Generate a fake answer.
std::unique_ptr<webrtc::SessionDescriptionInterface> answer(
@ -231,12 +231,8 @@ void SetRemoteSessionDescriptionObserver::OnSetRemoteDescriptionComplete(webrtc:
RTC_LOG(LS_INFO) << "Set remote description: " << error.message();
}
void SetLocalSessionDescriptionObserver::OnSuccess() {
RTC_LOG(LS_INFO) << "Set local description success!";
}
void SetLocalSessionDescriptionObserver::OnFailure(webrtc::RTCError error) {
RTC_LOG(LS_INFO) << "Set local description failure: " << error.message();
void SetLocalSessionDescriptionObserver::OnSetLocalDescriptionComplete(webrtc::RTCError error) {
RTC_LOG(LS_INFO) << "Set local description: " << error.message();
}
} // namespace webrtc_examples

Просмотреть файл

@ -369,7 +369,7 @@ void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) {
}
RTC_LOG(LS_INFO) << " Received session description :" << message;
peer_connection_->SetRemoteDescription(
DummySetSessionDescriptionObserver::Create(),
DummySetSessionDescriptionObserver::Create().get(),
session_description.release());
if (type == webrtc::SdpType::kOffer) {
peer_connection_->CreateAnswer(
@ -456,8 +456,9 @@ void Conductor::AddTracks() {
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
peer_connection_factory_->CreateAudioTrack(
kAudioLabel, peer_connection_factory_->CreateAudioSource(
cricket::AudioOptions())));
kAudioLabel,
peer_connection_factory_->CreateAudioSource(cricket::AudioOptions())
.get()));
auto result_or_error = peer_connection_->AddTrack(audio_track, {kStreamId});
if (!result_or_error.ok()) {
RTC_LOG(LS_ERROR) << "Failed to add audio track to PeerConnection: "
@ -468,8 +469,9 @@ void Conductor::AddTracks() {
CapturerTrackSource::Create();
if (video_device) {
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track_(
peer_connection_factory_->CreateVideoTrack(kVideoLabel, video_device));
main_wnd_->StartLocalRenderer(video_track_);
peer_connection_factory_->CreateVideoTrack(kVideoLabel,
video_device.get()));
main_wnd_->StartLocalRenderer(video_track_.get());
result_or_error = peer_connection_->AddTrack(video_track_, {kStreamId});
if (!result_or_error.ok()) {
@ -563,7 +565,7 @@ void Conductor::UIThreadCallback(int msg_id, void* data) {
void Conductor::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
peer_connection_->SetLocalDescription(
DummySetSessionDescriptionObserver::Create(), desc);
DummySetSessionDescriptionObserver::Create().get(), desc);
std::string sdp;
desc->ToString(&sdp);
@ -574,7 +576,7 @@ void Conductor::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
std::unique_ptr<webrtc::SessionDescriptionInterface> session_description =
webrtc::CreateSessionDescription(webrtc::SdpType::kAnswer, sdp);
peer_connection_->SetRemoteDescription(
DummySetSessionDescriptionObserver::Create(),
DummySetSessionDescriptionObserver::Create().get(),
session_description.release());
return;
}

Просмотреть файл

@ -103,7 +103,7 @@ int main(int argc, char* argv[]) {
PeerConnectionClient client;
auto conductor = rtc::make_ref_counted<Conductor>(&client, &wnd);
socket_server.set_client(&client);
socket_server.set_conductor(conductor);
socket_server.set_conductor(conductor.get());
thread.Run();

Просмотреть файл

@ -98,7 +98,7 @@ std::string GetPeerConnectionString() {
class DummySetSessionDescriptionObserver
: public webrtc::SetSessionDescriptionObserver {
public:
static DummySetSessionDescriptionObserver* Create() {
static rtc::scoped_refptr<DummySetSessionDescriptionObserver> Create() {
return rtc::make_ref_counted<DummySetSessionDescriptionObserver>();
}
virtual void OnSuccess() { RTC_LOG(LS_INFO) << __FUNCTION__; }
@ -259,7 +259,7 @@ bool SimplePeerConnection::CreateAnswer() {
void SimplePeerConnection::OnSuccess(
webrtc::SessionDescriptionInterface* desc) {
peer_connection_->SetLocalDescription(
DummySetSessionDescriptionObserver::Create(), desc);
DummySetSessionDescriptionObserver::Create().get(), desc);
std::string sdp;
desc->ToString(&sdp);
@ -350,7 +350,7 @@ bool SimplePeerConnection::SetRemoteDescription(const char* type,
}
RTC_LOG(LS_INFO) << " Received session description :" << remote_desc;
peer_connection_->SetRemoteDescription(
DummySetSessionDescriptionObserver::Create(), session_description);
DummySetSessionDescriptionObserver::Create().get(), session_description);
return true;
}
@ -392,8 +392,7 @@ void SimplePeerConnection::SetAudioControl() {
if (tracks.empty())
return;
webrtc::AudioTrackInterface* audio_track = tracks[0];
std::string id = audio_track->id();
rtc::scoped_refptr<webrtc::AudioTrackInterface>& audio_track = tracks[0];
if (is_record_audio_)
audio_track->AddSink(this);
else
@ -427,9 +426,9 @@ void SimplePeerConnection::AddStreams(bool audio_only) {
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
g_peer_connection_factory->CreateAudioTrack(
kAudioLabel, g_peer_connection_factory->CreateAudioSource(
cricket::AudioOptions())));
std::string id = audio_track->id();
kAudioLabel,
g_peer_connection_factory->CreateAudioSource(cricket::AudioOptions())
.get()));
stream->AddTrack(audio_track);
if (!audio_only) {
@ -470,7 +469,7 @@ void SimplePeerConnection::AddStreams(bool audio_only) {
if (video_device) {
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
g_peer_connection_factory->CreateVideoTrack(kVideoLabel,
video_device));
video_device.get()));
stream->AddTrack(video_track);
}
@ -481,7 +480,7 @@ void SimplePeerConnection::AddStreams(bool audio_only) {
}
}
if (!peer_connection_->AddStream(stream)) {
if (!peer_connection_->AddStream(stream.get())) {
RTC_LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
}

Просмотреть файл

@ -112,7 +112,7 @@ class SimplePeerConnection : public webrtc::PeerConnectionObserver,
std::unique_ptr<VideoObserver> local_video_observer_;
std::unique_ptr<VideoObserver> remote_video_observer_;
webrtc::MediaStreamInterface* remote_stream_ = nullptr;
rtc::scoped_refptr<webrtc::MediaStreamInterface> remote_stream_ = nullptr;
webrtc::PeerConnectionInterface::RTCConfiguration config_;
LOCALDATACHANNELREADY_CALLBACK OnLocalDataChannelReady = nullptr;

Просмотреть файл

@ -173,7 +173,7 @@ int RunServer() {
peer_connection->CreateDataChannelOrError("benchmark", nullptr);
auto data_channel = dc_or_error.MoveValue();
auto data_channel_observer =
std::make_unique<DataChannelObserverImpl>(data_channel);
std::make_unique<DataChannelObserverImpl>(data_channel.get());
data_channel->RegisterObserver(data_channel_observer.get());
absl::Cleanup unregister_observer(
[data_channel] { data_channel->UnregisterObserver(); });