Fix for deadlock in AudioUsesAbsSendTimeExtension test.
Bug: webrtc:10904 Change-Id: Iea7814384d0e15ea8539e18732c689fafff225b0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151763 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29096}
This commit is contained in:

committed by
Commit Bot

parent
a3baf2a3b1
commit
059a0b7587
@ -137,9 +137,9 @@ PeerScenarioClient::PeerScenarioClient(NetworkEmulationManager* net,
|
|||||||
});
|
});
|
||||||
handlers_.on_signaling_change.push_back(
|
handlers_.on_signaling_change.push_back(
|
||||||
[this](PeerConnectionInterface::SignalingState state) {
|
[this](PeerConnectionInterface::SignalingState state) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
if (state == PeerConnectionInterface::SignalingState::kStable &&
|
if (state == PeerConnectionInterface::SignalingState::kStable &&
|
||||||
peer_connection_->current_remote_description()) {
|
peer_connection_->current_remote_description()) {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
|
||||||
for (const auto& candidate : pending_ice_candidates_) {
|
for (const auto& candidate : pending_ice_candidates_) {
|
||||||
RTC_CHECK(peer_connection_->AddIceCandidate(candidate.get()));
|
RTC_CHECK(peer_connection_->AddIceCandidate(candidate.get()));
|
||||||
}
|
}
|
||||||
@ -203,6 +203,7 @@ EmulatedEndpoint* PeerScenarioClient::endpoint(int index) {
|
|||||||
PeerScenarioClient::AudioSendTrack PeerScenarioClient::CreateAudio(
|
PeerScenarioClient::AudioSendTrack PeerScenarioClient::CreateAudio(
|
||||||
std::string track_id,
|
std::string track_id,
|
||||||
cricket::AudioOptions options) {
|
cricket::AudioOptions options) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
AudioSendTrack res;
|
AudioSendTrack res;
|
||||||
auto source = pc_factory_->CreateAudioSource(options);
|
auto source = pc_factory_->CreateAudioSource(options);
|
||||||
auto track = pc_factory_->CreateAudioTrack(track_id, source);
|
auto track = pc_factory_->CreateAudioTrack(track_id, source);
|
||||||
@ -214,6 +215,7 @@ PeerScenarioClient::AudioSendTrack PeerScenarioClient::CreateAudio(
|
|||||||
PeerScenarioClient::VideoSendTrack PeerScenarioClient::CreateVideo(
|
PeerScenarioClient::VideoSendTrack PeerScenarioClient::CreateVideo(
|
||||||
std::string track_id,
|
std::string track_id,
|
||||||
VideoSendTrackConfig config) {
|
VideoSendTrackConfig config) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
VideoSendTrack res;
|
VideoSendTrack res;
|
||||||
auto capturer = FrameGeneratorCapturer::Create(clock(), *task_queue_factory_,
|
auto capturer = FrameGeneratorCapturer::Create(clock(), *task_queue_factory_,
|
||||||
config.generator);
|
config.generator);
|
||||||
@ -237,15 +239,16 @@ void PeerScenarioClient::AddVideoReceiveSink(
|
|||||||
|
|
||||||
void PeerScenarioClient::CreateAndSetSdp(
|
void PeerScenarioClient::CreateAndSetSdp(
|
||||||
std::function<void(std::string)> offer_handler) {
|
std::function<void(std::string)> offer_handler) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
peer_connection_->CreateOffer(
|
peer_connection_->CreateOffer(
|
||||||
SdpCreateObserver([=](SessionDescriptionInterface* offer) {
|
SdpCreateObserver([=](SessionDescriptionInterface* offer) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
std::string sdp_offer;
|
std::string sdp_offer;
|
||||||
offer->ToString(&sdp_offer);
|
offer->ToString(&sdp_offer);
|
||||||
RTC_LOG(LS_INFO) << sdp_offer;
|
RTC_LOG(LS_INFO) << sdp_offer;
|
||||||
peer_connection_->SetLocalDescription(
|
peer_connection_->SetLocalDescription(
|
||||||
SdpSetObserver([sdp_offer, offer_handler]() {
|
SdpSetObserver(
|
||||||
offer_handler(std::move(sdp_offer));
|
[sdp_offer, offer_handler]() { offer_handler(sdp_offer); }),
|
||||||
}),
|
|
||||||
offer);
|
offer);
|
||||||
}),
|
}),
|
||||||
PeerConnectionInterface::RTCOfferAnswerOptions());
|
PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
@ -254,11 +257,20 @@ void PeerScenarioClient::CreateAndSetSdp(
|
|||||||
void PeerScenarioClient::SetSdpOfferAndGetAnswer(
|
void PeerScenarioClient::SetSdpOfferAndGetAnswer(
|
||||||
std::string remote_offer,
|
std::string remote_offer,
|
||||||
std::function<void(std::string)> answer_handler) {
|
std::function<void(std::string)> answer_handler) {
|
||||||
|
if (!signaling_thread_->IsCurrent()) {
|
||||||
|
signaling_thread_->PostTask(RTC_FROM_HERE, [=] {
|
||||||
|
SetSdpOfferAndGetAnswer(remote_offer, answer_handler);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
peer_connection_->SetRemoteDescription(
|
peer_connection_->SetRemoteDescription(
|
||||||
CreateSessionDescription(SdpType::kOffer, remote_offer),
|
CreateSessionDescription(SdpType::kOffer, remote_offer),
|
||||||
SdpSetObserver([=]() {
|
SdpSetObserver([=]() {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
peer_connection_->CreateAnswer(
|
peer_connection_->CreateAnswer(
|
||||||
SdpCreateObserver([=](SessionDescriptionInterface* answer) {
|
SdpCreateObserver([=](SessionDescriptionInterface* answer) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
std::string sdp_answer;
|
std::string sdp_answer;
|
||||||
answer->ToString(&sdp_answer);
|
answer->ToString(&sdp_answer);
|
||||||
RTC_LOG(LS_INFO) << sdp_answer;
|
RTC_LOG(LS_INFO) << sdp_answer;
|
||||||
@ -275,6 +287,12 @@ void PeerScenarioClient::SetSdpOfferAndGetAnswer(
|
|||||||
void PeerScenarioClient::SetSdpAnswer(
|
void PeerScenarioClient::SetSdpAnswer(
|
||||||
std::string remote_answer,
|
std::string remote_answer,
|
||||||
std::function<void(const SessionDescriptionInterface&)> done_handler) {
|
std::function<void(const SessionDescriptionInterface&)> done_handler) {
|
||||||
|
if (!signaling_thread_->IsCurrent()) {
|
||||||
|
signaling_thread_->PostTask(
|
||||||
|
RTC_FROM_HERE, [=] { SetSdpAnswer(remote_answer, done_handler); });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
peer_connection_->SetRemoteDescription(
|
peer_connection_->SetRemoteDescription(
|
||||||
CreateSessionDescription(SdpType::kAnswer, remote_answer),
|
CreateSessionDescription(SdpType::kAnswer, remote_answer),
|
||||||
SdpSetObserver([remote_answer, done_handler] {
|
SdpSetObserver([remote_answer, done_handler] {
|
||||||
@ -285,12 +303,12 @@ void PeerScenarioClient::SetSdpAnswer(
|
|||||||
|
|
||||||
void PeerScenarioClient::AddIceCandidate(
|
void PeerScenarioClient::AddIceCandidate(
|
||||||
std::unique_ptr<IceCandidateInterface> candidate) {
|
std::unique_ptr<IceCandidateInterface> candidate) {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
if (peer_connection_->signaling_state() ==
|
if (peer_connection_->signaling_state() ==
|
||||||
PeerConnectionInterface::SignalingState::kStable &&
|
PeerConnectionInterface::SignalingState::kStable &&
|
||||||
peer_connection_->current_remote_description()) {
|
peer_connection_->current_remote_description()) {
|
||||||
RTC_CHECK(peer_connection_->AddIceCandidate(candidate.get()));
|
RTC_CHECK(peer_connection_->AddIceCandidate(candidate.get()));
|
||||||
} else {
|
} else {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
|
||||||
pending_ice_candidates_.push_back(std::move(candidate));
|
pending_ice_candidates_.push_back(std::move(candidate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,10 @@ class PeerScenarioClient {
|
|||||||
Config config);
|
Config config);
|
||||||
|
|
||||||
PeerConnectionFactoryInterface* factory() { return pc_factory_.get(); }
|
PeerConnectionFactoryInterface* factory() { return pc_factory_.get(); }
|
||||||
PeerConnectionInterface* pc() { return peer_connection_.get(); }
|
PeerConnectionInterface* pc() {
|
||||||
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
|
return peer_connection_.get();
|
||||||
|
}
|
||||||
rtc::Thread* thread() { return signaling_thread_; }
|
rtc::Thread* thread() { return signaling_thread_; }
|
||||||
Clock* clock() { return Clock::GetRealTimeClock(); }
|
Clock* clock() { return Clock::GetRealTimeClock(); }
|
||||||
|
|
||||||
@ -150,7 +153,8 @@ class PeerScenarioClient {
|
|||||||
RTC_GUARDED_BY(signaling_thread_);
|
RTC_GUARDED_BY(signaling_thread_);
|
||||||
|
|
||||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
|
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> peer_connection_;
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection_
|
||||||
|
RTC_GUARDED_BY(signaling_thread_);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
Reference in New Issue
Block a user