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

Commit b8ca2a1

Browse files
fippoCommit Bot
authored andcommitted
count plan-b/unified-plan usage in SDP answers
the UMA stats currently do not count services like Hangouts that have "complex" SDP with multiple tracks only in the answer, not in the offer. Note that this changes the definition of the existing metric. BUG=chromium:857004 Change-Id: Ib4520a82f7d94cdd4a307d32846e2d26a5f03b90 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186701 Reviewed-by: Harald Alvestrand <[email protected]> Commit-Queue: Philipp Hancke <[email protected]> Cr-Commit-Position: refs/heads/master@{#32355}
1 parent 441dbf9 commit b8ca2a1

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

pc/peer_connection.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,8 +3009,21 @@ void PeerConnection::ReportSdpFormatReceived(
30093009
} else if (num_audio_tracks > 0 || num_video_tracks > 0) {
30103010
format = kSdpFormatReceivedSimple;
30113011
}
3012-
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.SdpFormatReceived", format,
3013-
kSdpFormatReceivedMax);
3012+
switch (remote_offer.GetType()) {
3013+
case SdpType::kOffer:
3014+
// Historically only offers were counted.
3015+
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.SdpFormatReceived",
3016+
format, kSdpFormatReceivedMax);
3017+
break;
3018+
case SdpType::kAnswer:
3019+
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.SdpFormatReceivedAnswer",
3020+
format, kSdpFormatReceivedMax);
3021+
break;
3022+
default:
3023+
RTC_LOG(LS_ERROR) << "Can not report SdpFormatReceived for "
3024+
<< SdpTypeToString(remote_offer.GetType());
3025+
break;
3026+
}
30143027
}
30153028

30163029
void PeerConnection::ReportIceCandidateCollected(

pc/peer_connection_rtp_unittest.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,19 @@ TEST_F(SdpFormatReceivedTest, ComplexPlanBIsReportedAsComplexPlanB) {
18551855
ElementsAre(Pair(kSdpFormatReceivedComplexPlanB, 1)));
18561856
}
18571857

1858+
TEST_F(SdpFormatReceivedTest, AnswerIsReported) {
1859+
auto caller = CreatePeerConnectionWithPlanB();
1860+
caller->AddAudioTrack("audio");
1861+
caller->AddVideoTrack("video");
1862+
auto callee = CreatePeerConnectionWithUnifiedPlan();
1863+
1864+
ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()));
1865+
ASSERT_TRUE(caller->SetRemoteDescription(callee->CreateAnswer()));
1866+
EXPECT_METRIC_THAT(
1867+
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceivedAnswer"),
1868+
ElementsAre(Pair(kSdpFormatReceivedSimple, 1)));
1869+
}
1870+
18581871
// Sender setups in a call.
18591872

18601873
TEST_P(PeerConnectionRtpTest, CreateTwoSendersWithSameTrack) {

pc/sdp_offer_answer.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,8 +2009,9 @@ void SdpOfferAnswerHandler::DoSetRemoteDescription(
20092009
"Rollback not supported in Plan B"));
20102010
return;
20112011
}
2012-
if (desc->GetType() == SdpType::kOffer) {
2013-
// Report to UMA the format of the received offer.
2012+
if (desc->GetType() == SdpType::kOffer ||
2013+
desc->GetType() == SdpType::kAnswer) {
2014+
// Report to UMA the format of the received offer or answer.
20142015
pc_->ReportSdpFormatReceived(*desc);
20152016
}
20162017

0 commit comments

Comments
 (0)