Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 8b30942

Browse files
authored
Merge pull request #487 from taste1981/m88
Upgrade webrtc stack to M88
2 parents b2e2448 + 634d579 commit 8b30942

File tree

6 files changed

+81
-37
lines changed

6 files changed

+81
-37
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ deps = {
319319
Var('chromium_git') + '/infra/luci/client-py.git' + '@' + Var('swarming_revision'),
320320
# WebRTC-only dependencies (not present in Chromium).
321321
'src/third_party/webrtc':
322-
Var('deps_webrtc_git') + '/owt-deps-webrtc' + '@' + '05d78cc78a30bd97e6411b8180b4dd24d6027efa',
322+
Var('deps_webrtc_git') + '/owt-deps-webrtc' + '@' + '2619b2535ce802ac36466a5f7141e40903691ba1',
323323
'src/third_party/accessibility_test_framework': {
324324
'packages': [
325325
{

jenkins/windows.jenkinsfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,27 @@ pipeline {
1515
timeout(time: 40, unit: "MINUTES")
1616
}
1717
stages {
18+
stage("init paramters"){
19+
steps {
20+
script {
21+
if (env.CHANGE_TARGET == null){
22+
env.CHANGE_TARGET = env.GIT_BRANCH
23+
}
24+
}
25+
}
26+
}
1827
stage("BuildAndEnv"){
1928
parallel {
2029
stage("build") {
2130
agent{
2231
node {
2332
label "windows"
24-
customWorkspace "$env.windowsCIPath/src"
33+
customWorkspace "${env.windowsCIPathBranch}_${env.CHANGE_TARGET}/src"
2534
}
2635
}
2736
steps {
2837
echo "$GIT_COMMIT"
29-
bat "%windowsCIPath%/buildSdk.bat %GIT_COMMIT%"
38+
bat "%windowsCIPathBranch%_%CHANGE_TARGET%/buildSdk.bat %GIT_COMMIT%"
3039
}
3140
}
3241
stage("startMcu") {
@@ -124,4 +133,3 @@ pipeline {
124133
}
125134
}
126135
}
127-

scripts/prepare_dev.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
FFMPEG_PATH = os.path.join(THIRD_PARTY_PATH, 'ffmpeg')
2121
WEBRTC_OVERRIDES_PATH = os.path.join(THIRD_PARTY_PATH, 'webrtc_overrides')
2222
BUILD_PATH = os.path.join(HOME_PATH, 'build')
23+
CONFIG_PATH = os.path.join(BUILD_PATH, 'config')
2324
TOOL_PATH = os.path.join(HOME_PATH, 'tools')
2425
BASE_PATH = os.path.join(HOME_PATH, 'base')
2526
platform = os.name
@@ -50,6 +51,10 @@ def _patch(ignoreFailures=False):
5051
cwd=applyPath)
5152
else:
5253
sys.exit(1)
54+
# create empty gclient_args.gni under bulid/config if not already
55+
gclientArgPath = os.path.join(CONFIG_PATH, 'gclient_args.gni')
56+
if not os.path.isfile(gclientArgPath):
57+
open(gclientArgPath, "w").close()
5358

5459
def main(argv):
5560
_patch()

talk/owt/sdk/base/customizedvideoencoderproxy.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ int32_t CustomizedVideoEncoderProxy::Encode(
211211
info.codecSpecific.H264.idr_frame = is_idr;
212212
info.codecSpecific.H264.base_layer_sync = (!is_idr && (temporal_id > 0));
213213
}
214+
encodedframe._frameType = is_idr ? webrtc::VideoFrameType::kVideoFrameKey
215+
: webrtc::VideoFrameType::kVideoFrameDelta;
214216
}
215217
const auto result = callback_->OnEncodedImage(encodedframe, &info);
216218
if (result.error != webrtc::EncodedImageCallback::Result::Error::OK) {

talk/owt/sdk/p2p/p2ppeerconnectionchannel.cc

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,17 @@ void P2PPeerConnectionChannel::OnMessageSignal(Json::Value& message) {
503503
&sdp_mline_index);
504504
webrtc::IceCandidateInterface* ice_candidate = webrtc::CreateIceCandidate(
505505
sdp_mid, sdp_mline_index, candidate, nullptr);
506-
peer_connection_->AddIceCandidate(ice_candidate);
506+
if(peer_connection_->remote_description()){
507+
if (!peer_connection_->AddIceCandidate(ice_candidate)) {
508+
RTC_LOG(LS_WARNING) << "Failed to add remote candidate.";
509+
}
510+
} else{
511+
webrtc::MutexLock lock(&pending_remote_candidates_crit_);
512+
pending_remote_candidates_.push_back(
513+
std::unique_ptr<webrtc::IceCandidateInterface>(ice_candidate));
514+
RTC_LOG(LS_VERBOSE) << "Remote candidate is stored because remote "
515+
"session description is missing.";
516+
}
507517
}
508518
}
509519
void P2PPeerConnectionChannel::OnMessageTracksAdded(
@@ -561,44 +571,47 @@ void P2PPeerConnectionChannel::OnMessageTrackSources(
561571
void P2PPeerConnectionChannel::OnMessageStreamInfo(Json::Value& stream_info) {
562572
// Stream information is useless in native layer.
563573
}
574+
564575
void P2PPeerConnectionChannel::OnSignalingChange(
565576
PeerConnectionInterface::SignalingState new_state) {
566577
RTC_LOG(LS_INFO) << "Signaling state changed: " << new_state;
567-
switch (new_state) {
568-
case PeerConnectionInterface::SignalingState::kStable:
569-
if (pending_remote_sdp_) {
570-
scoped_refptr<FunctionalSetRemoteDescriptionObserver> observer =
571-
FunctionalSetRemoteDescriptionObserver::Create(std::bind(
572-
&P2PPeerConnectionChannel::OnSetRemoteDescriptionComplete, this,
573-
std::placeholders::_1));
574-
std::string sdp_string;
575-
if (!pending_remote_sdp_->ToString(&sdp_string)) {
576-
RTC_LOG(LS_ERROR) << "Error parsing local description.";
577-
RTC_DCHECK(false);
578-
}
579-
std::vector<AudioCodec> audio_codecs;
580-
for (auto& audio_enc_param : configuration_.audio) {
581-
audio_codecs.push_back(audio_enc_param.codec.name);
582-
}
583-
sdp_string = SdpUtils::SetPreferAudioCodecs(sdp_string, audio_codecs);
584-
std::vector<VideoCodec> video_codecs;
585-
for (auto& video_enc_param : configuration_.video) {
586-
video_codecs.push_back(video_enc_param.codec.name);
587-
}
588-
sdp_string = SdpUtils::SetPreferVideoCodecs(sdp_string, video_codecs);
589-
std::unique_ptr<webrtc::SessionDescriptionInterface> new_desc(
590-
webrtc::CreateSessionDescription(pending_remote_sdp_->type(),
591-
sdp_string, nullptr));
592-
pending_remote_sdp_.reset();
593-
peer_connection_->SetRemoteDescription(std::move(new_desc), observer);
594-
} else {
595-
CheckWaitedList();
578+
if (new_state == PeerConnectionInterface::SignalingState::kStable) {
579+
if (pending_remote_sdp_) {
580+
scoped_refptr<FunctionalSetRemoteDescriptionObserver> observer =
581+
FunctionalSetRemoteDescriptionObserver::Create(std::bind(
582+
&P2PPeerConnectionChannel::OnSetRemoteDescriptionComplete, this,
583+
std::placeholders::_1));
584+
std::string sdp_string;
585+
if (!pending_remote_sdp_->ToString(&sdp_string)) {
586+
RTC_LOG(LS_ERROR) << "Error parsing local description.";
587+
RTC_DCHECK(false);
596588
}
597-
break;
598-
default:
599-
break;
589+
std::vector<AudioCodec> audio_codecs;
590+
for (auto& audio_enc_param : configuration_.audio) {
591+
audio_codecs.push_back(audio_enc_param.codec.name);
592+
}
593+
sdp_string = SdpUtils::SetPreferAudioCodecs(sdp_string, audio_codecs);
594+
std::vector<VideoCodec> video_codecs;
595+
for (auto& video_enc_param : configuration_.video) {
596+
video_codecs.push_back(video_enc_param.codec.name);
597+
}
598+
sdp_string = SdpUtils::SetPreferVideoCodecs(sdp_string, video_codecs);
599+
std::unique_ptr<webrtc::SessionDescriptionInterface> new_desc(
600+
webrtc::CreateSessionDescription(pending_remote_sdp_->type(),
601+
sdp_string, nullptr));
602+
pending_remote_sdp_.reset();
603+
peer_connection_->SetRemoteDescription(std::move(new_desc), observer);
604+
} else {
605+
CheckWaitedList();
606+
}
607+
}
608+
609+
if (new_state == PeerConnectionInterface::SignalingState::kStable ||
610+
new_state == PeerConnectionInterface::SignalingState::kHaveRemoteOffer) {
611+
DrainPendingRemoteCandidates();
600612
}
601613
}
614+
602615
void P2PPeerConnectionChannel::OnAddStream(
603616
rtc::scoped_refptr<MediaStreamInterface> stream) {
604617
Json::Value stream_tracks;
@@ -1247,6 +1260,17 @@ void P2PPeerConnectionChannel::DrainPendingMessages() {
12471260
pending_messages_.clear();
12481261
}
12491262
}
1263+
1264+
void P2PPeerConnectionChannel::DrainPendingRemoteCandidates() {
1265+
webrtc::MutexLock lock(&pending_remote_candidates_crit_);
1266+
for (auto& ice_candidate : pending_remote_candidates_) {
1267+
if (!peer_connection_->AddIceCandidate(ice_candidate.get())) {
1268+
RTC_LOG(LS_WARNING) << "Failed to add remote candidate.";
1269+
}
1270+
}
1271+
pending_remote_candidates_.clear();
1272+
}
1273+
12501274
Json::Value P2PPeerConnectionChannel::UaInfo() {
12511275
Json::Value ua;
12521276
// SDK info includes verison and type.

talk/owt/sdk/p2p/p2ppeerconnectionchannel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class P2PPeerConnectionChannel : public P2PSignalingReceiverInterface,
159159
// Send all messages in pending message list.
160160
void DrainPendingMessages();
161161
// Cleans all variables associated with last peerconnection.
162+
void DrainPendingRemoteCandidates();
162163
void CleanLastPeerConnection();
163164
// Returns user agent info as JSON object.
164165
Json::Value UaInfo();
@@ -212,6 +213,10 @@ class P2PPeerConnectionChannel : public P2PSignalingReceiverInterface,
212213
pending_messages_;
213214
// Protects |pending_messages_|.
214215
std::mutex pending_messages_mutex_;
216+
webrtc::Mutex pending_remote_candidates_crit_;
217+
std::vector<std::unique_ptr<webrtc::IceCandidateInterface>>
218+
pending_remote_candidates_
219+
RTC_GUARDED_BY(pending_remote_candidates_crit_);
215220
// Indicates whether remote client supports WebRTC Plan B
216221
// (https://tools.ietf.org/html/draft-uberti-rtcweb-plan-00).
217222
// If plan B is not supported, at most one audio/video track is supported.

0 commit comments

Comments
 (0)