Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: webrtc/pc/peerconnection_integrationtest.cc

Issue 2883943003: Add media related stats (audio level etc.) to unsignaled streams. (Closed)
Patch Set: Fix the bug related to the unsignaled video track. Modified the test. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/pc/trackmediainfomap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnection_integrationtest.cc
diff --git a/webrtc/pc/peerconnection_integrationtest.cc b/webrtc/pc/peerconnection_integrationtest.cc
index ad1a12caf6d323ff3dbd4c93b4479896d2d85414..e6c3cf1f5781f18e493cbbb7f7d0cf3b83a6b6fc 100644
--- a/webrtc/pc/peerconnection_integrationtest.cc
+++ b/webrtc/pc/peerconnection_integrationtest.cc
@@ -116,6 +116,18 @@ void RemoveSsrcsAndMsids(cricket::SessionDescription* desc) {
desc->set_msid_supported(false);
}
+int FindFirstMediaStatsIndexByKind(
+ const std::string& kind,
+ const std::vector<const webrtc::RTCMediaStreamTrackStats*>&
+ media_stats_vec) {
+ for (size_t i = 0; i < media_stats_vec.size(); i++) {
+ if (media_stats_vec[i]->kind.ValueToString() == kind) {
+ return i;
+ }
+ }
+ return -1;
+}
+
class SignalingMessageReceiver {
public:
virtual void ReceiveSdpMessage(const std::string& type,
@@ -1926,9 +1938,31 @@ TEST_F(PeerConnectionIntegrationTest,
ASSERT_EQ(1U, inbound_stream_stats.size());
ASSERT_TRUE(inbound_stream_stats[0]->bytes_received.is_defined());
ASSERT_GT(*inbound_stream_stats[0]->bytes_received, 0U);
- // TODO(deadbeef): Test that track_id is defined. This is not currently
- // working since SSRCs are used to match RtpReceivers (and their tracks) with
- // received stream stats in TrackMediaInfoMap.
+ ASSERT_TRUE(inbound_stream_stats[0]->track_id.is_defined());
+}
+
+// Test that we can successfully get the media related stats (audio level
+// etc.) for the unsignaled stream.
+TEST_F(PeerConnectionIntegrationTest,
+ GetMediaStatsForUnsignaledStreamWithNewStatsApi) {
+ ASSERT_TRUE(CreatePeerConnectionWrappers());
+ ConnectFakeSignaling();
+ caller()->AddAudioVideoMediaStream();
+ // Remove SSRCs and MSIDs from the received offer SDP.
+ callee()->SetReceivedSdpMunger(RemoveSsrcsAndMsids);
+ caller()->CreateAndSetAndSignalOffer();
+ ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
+ // Wait for one audio frame to be received by the callee.
+ ExpectNewFramesReceivedWithWait(0, 0, 1, 1, kMaxWaitForFramesMs);
+
+ rtc::scoped_refptr<const webrtc::RTCStatsReport> report =
+ callee()->NewGetStats();
+ ASSERT_NE(nullptr, report);
+
+ auto media_stats = report->GetStatsOfType<webrtc::RTCMediaStreamTrackStats>();
+ auto audio_index = FindFirstMediaStatsIndexByKind("audio", media_stats);
+ ASSERT_GE(audio_index, 0);
+ EXPECT_TRUE(media_stats[audio_index]->audio_level.is_defined());
}
// Test that DTLS 1.0 is used if both sides only support DTLS 1.0.
« no previous file with comments | « no previous file | webrtc/pc/trackmediainfomap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698