OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/api/rtcstatscollector.h" | 11 #include "webrtc/api/rtcstatscollector.h" |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <ostream> | 14 #include <ostream> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/api/jsepsessiondescription.h" | 18 #include "webrtc/api/jsepsessiondescription.h" |
19 #include "webrtc/api/mediastream.h" | 19 #include "webrtc/api/mediastream.h" |
20 #include "webrtc/api/mediastreamtrack.h" | 20 #include "webrtc/api/mediastreamtrack.h" |
21 #include "webrtc/api/rtpparameters.h" | 21 #include "webrtc/api/rtpparameters.h" |
22 #include "webrtc/api/rtpreceiverinterface.h" | |
23 #include "webrtc/api/rtpsenderinterface.h" | |
22 #include "webrtc/api/stats/rtcstats_objects.h" | 24 #include "webrtc/api/stats/rtcstats_objects.h" |
23 #include "webrtc/api/stats/rtcstatsreport.h" | 25 #include "webrtc/api/stats/rtcstatsreport.h" |
26 #include "webrtc/api/test/fakertpsenderreceiver.h" | |
24 #include "webrtc/api/test/mock_datachannel.h" | 27 #include "webrtc/api/test/mock_datachannel.h" |
25 #include "webrtc/api/test/mock_peerconnection.h" | 28 #include "webrtc/api/test/mock_peerconnection.h" |
26 #include "webrtc/api/test/mock_webrtcsession.h" | 29 #include "webrtc/api/test/mock_webrtcsession.h" |
27 #include "webrtc/api/test/rtcstatsobtainer.h" | 30 #include "webrtc/api/test/rtcstatsobtainer.h" |
28 #include "webrtc/base/checks.h" | 31 #include "webrtc/base/checks.h" |
29 #include "webrtc/base/fakeclock.h" | 32 #include "webrtc/base/fakeclock.h" |
30 #include "webrtc/base/fakesslidentity.h" | 33 #include "webrtc/base/fakesslidentity.h" |
31 #include "webrtc/base/gunit.h" | 34 #include "webrtc/base/gunit.h" |
32 #include "webrtc/base/logging.h" | 35 #include "webrtc/base/logging.h" |
33 #include "webrtc/base/socketaddress.h" | 36 #include "webrtc/base/socketaddress.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 MediaControllerInterface::Create(cricket::MediaConfig(), | 305 MediaControllerInterface::Create(cricket::MediaConfig(), |
303 worker_thread_, | 306 worker_thread_, |
304 channel_manager_.get(), | 307 channel_manager_.get(), |
305 &event_log_)), | 308 &event_log_)), |
306 session_(media_controller_.get()), | 309 session_(media_controller_.get()), |
307 pc_() { | 310 pc_() { |
308 // Default return values for mocks. | 311 // Default return values for mocks. |
309 EXPECT_CALL(pc_, local_streams()).WillRepeatedly(Return(nullptr)); | 312 EXPECT_CALL(pc_, local_streams()).WillRepeatedly(Return(nullptr)); |
310 EXPECT_CALL(pc_, remote_streams()).WillRepeatedly(Return(nullptr)); | 313 EXPECT_CALL(pc_, remote_streams()).WillRepeatedly(Return(nullptr)); |
311 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); | 314 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); |
315 EXPECT_CALL(pc_, GetSenders()).WillRepeatedly(Return( | |
316 std::vector<rtc::scoped_refptr<RtpSenderInterface>>())); | |
317 EXPECT_CALL(pc_, GetReceivers()).WillRepeatedly(Return( | |
318 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>())); | |
312 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( | 319 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( |
313 ReturnRef(data_channels_)); | 320 ReturnRef(data_channels_)); |
314 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 321 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
315 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 322 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
316 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull()); | 323 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull()); |
317 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( | 324 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( |
318 Return(false)); | 325 Return(false)); |
319 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) | 326 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) |
320 .WillRepeatedly(Return(nullptr)); | 327 .WillRepeatedly(Return(nullptr)); |
321 } | 328 } |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1233 remote_audio_processor_stats.echo_return_loss = 13; | 1240 remote_audio_processor_stats.echo_return_loss = 13; |
1234 remote_audio_processor_stats.echo_return_loss_enhancement = 37; | 1241 remote_audio_processor_stats.echo_return_loss_enhancement = 37; |
1235 rtc::scoped_refptr<FakeAudioTrackForStats> remote_audio_track = | 1242 rtc::scoped_refptr<FakeAudioTrackForStats> remote_audio_track = |
1236 FakeAudioTrackForStats::Create( | 1243 FakeAudioTrackForStats::Create( |
1237 "RemoteAudioTrackID", | 1244 "RemoteAudioTrackID", |
1238 MediaStreamTrackInterface::TrackState::kLive, | 1245 MediaStreamTrackInterface::TrackState::kLive, |
1239 0, | 1246 0, |
1240 new FakeAudioProcessorForStats(remote_audio_processor_stats)); | 1247 new FakeAudioProcessorForStats(remote_audio_processor_stats)); |
1241 remote_stream->AddTrack(remote_audio_track); | 1248 remote_stream->AddTrack(remote_audio_track); |
1242 | 1249 |
1250 // RTP sender/receivers for local/remote track to wire up SSRCs. | |
1251 std::vector<rtc::scoped_refptr<RtpSenderInterface>> rtp_senders; | |
1252 rtc::scoped_refptr<FakeRtpSender> rtp_sender = | |
1253 new FakeRtpSender(cricket::MEDIA_TYPE_AUDIO, | |
1254 CreateRtpParametersWithSsrc(1)); | |
1255 rtp_sender->SetTrack(local_audio_track); | |
1256 rtp_senders.push_back(rtp_sender); | |
1257 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> rtp_receivers; | |
1258 rtc::scoped_refptr<FakeRtpReceiver> rtp_receiver = | |
1259 new FakeRtpReceiver(cricket::MEDIA_TYPE_AUDIO, | |
1260 CreateRtpParametersWithSsrc(4)); | |
Taylor Brandstetter
2017/01/04 00:36:56
May be overkill, but you could also test what happ
| |
1261 rtp_receiver->SetTrack(remote_audio_track); | |
1262 rtp_receivers.push_back(rtp_receiver); | |
1263 EXPECT_CALL(test_->pc(), GetSenders()).WillRepeatedly( | |
1264 Return(rtp_senders)); | |
1265 EXPECT_CALL(test_->pc(), GetReceivers()).WillRepeatedly( | |
1266 Return(rtp_receivers)); | |
1267 | |
1268 // |VoiceMediaInfo| for the above referenced SSRCs | |
1269 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | |
1270 cricket::VoiceChannel voice_channel( | |
1271 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | |
1272 voice_media_channel, nullptr, "VoiceContentName", kDefaultRtcpEnabled, | |
1273 kDefaultSrtpRequired); | |
1274 cricket::VoiceMediaInfo voice_media_info; | |
1275 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | |
1276 voice_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1277 voice_media_info.senders[0].local_stats[0].ssrc = 101010; // noise | |
1278 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | |
1279 voice_media_info.senders[1].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1280 voice_media_info.senders[1].local_stats[0].ssrc = 1; | |
1281 voice_media_info.senders[1].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1282 voice_media_info.senders[1].local_stats[1].ssrc = 2; | |
1283 voice_media_info.senders[1].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1284 voice_media_info.senders[1].local_stats[2].ssrc = 3; | |
1285 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | |
1286 voice_media_info.senders[2].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1287 voice_media_info.senders[2].local_stats[0].ssrc = 202020; // noise | |
1288 voice_media_info.receivers.push_back(cricket::VoiceReceiverInfo()); | |
1289 voice_media_info.receivers[0].local_stats.push_back( | |
1290 cricket::SsrcReceiverInfo()); | |
1291 voice_media_info.receivers[0].local_stats[0].ssrc = 4; | |
1292 EXPECT_CALL(*voice_media_channel, GetStats(_)) | |
1293 .WillOnce(DoAll(SetArgPointee<0>(voice_media_info), Return(true))); | |
1294 SessionStats session_stats; | |
1295 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; | |
1296 session_stats.transport_stats["TransportName"].transport_name = | |
1297 "TransportName"; | |
1298 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( | |
1299 [&session_stats](const ChannelNamePairs&) { | |
1300 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); | |
1301 })); | |
1302 EXPECT_CALL(test_->session(), voice_channel()) | |
1303 .WillRepeatedly(Return(&voice_channel)); | |
1304 | |
1243 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1305 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1244 | 1306 |
1245 RTCMediaStreamStats expected_local_stream( | 1307 RTCMediaStreamStats expected_local_stream( |
1246 "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us()); | 1308 "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us()); |
1247 expected_local_stream.stream_identifier = local_stream->label(); | 1309 expected_local_stream.stream_identifier = local_stream->label(); |
1248 expected_local_stream.track_ids = std::vector<std::string>(); | 1310 expected_local_stream.track_ids = std::vector<std::string>(); |
1249 expected_local_stream.track_ids->push_back( | 1311 expected_local_stream.track_ids->push_back( |
1250 "RTCMediaStreamTrack_LocalAudioTrackID"); | 1312 "RTCMediaStreamTrack_local_LocalAudioTrackID"); |
1251 ASSERT_TRUE(report->Get(expected_local_stream.id())); | 1313 ASSERT_TRUE(report->Get(expected_local_stream.id())); |
1252 EXPECT_EQ(expected_local_stream, | 1314 EXPECT_EQ(expected_local_stream, |
1253 report->Get(expected_local_stream.id())->cast_to< | 1315 report->Get(expected_local_stream.id())->cast_to< |
1254 RTCMediaStreamStats>()); | 1316 RTCMediaStreamStats>()); |
1255 | 1317 |
1256 RTCMediaStreamStats expected_remote_stream( | 1318 RTCMediaStreamStats expected_remote_stream( |
1257 "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us()); | 1319 "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us()); |
1258 expected_remote_stream.stream_identifier = remote_stream->label(); | 1320 expected_remote_stream.stream_identifier = remote_stream->label(); |
1259 expected_remote_stream.track_ids = std::vector<std::string>(); | 1321 expected_remote_stream.track_ids = std::vector<std::string>(); |
1260 expected_remote_stream.track_ids->push_back( | 1322 expected_remote_stream.track_ids->push_back( |
1261 "RTCMediaStreamTrack_RemoteAudioTrackID"); | 1323 "RTCMediaStreamTrack_remote_RemoteAudioTrackID"); |
1262 ASSERT_TRUE(report->Get(expected_remote_stream.id())); | 1324 ASSERT_TRUE(report->Get(expected_remote_stream.id())); |
1263 EXPECT_EQ(expected_remote_stream, | 1325 EXPECT_EQ(expected_remote_stream, |
1264 report->Get(expected_remote_stream.id())->cast_to< | 1326 report->Get(expected_remote_stream.id())->cast_to< |
1265 RTCMediaStreamStats>()); | 1327 RTCMediaStreamStats>()); |
1266 | 1328 |
1267 RTCMediaStreamTrackStats expected_local_audio_track( | 1329 RTCMediaStreamTrackStats expected_local_audio_track( |
1268 "RTCMediaStreamTrack_LocalAudioTrackID", report->timestamp_us()); | 1330 "RTCMediaStreamTrack_local_LocalAudioTrackID", report->timestamp_us()); |
1269 expected_local_audio_track.track_identifier = local_audio_track->id(); | 1331 expected_local_audio_track.track_identifier = local_audio_track->id(); |
1270 expected_local_audio_track.remote_source = false; | 1332 expected_local_audio_track.remote_source = false; |
1271 expected_local_audio_track.ended = true; | 1333 expected_local_audio_track.ended = true; |
1272 expected_local_audio_track.detached = false; | 1334 expected_local_audio_track.detached = false; |
1335 expected_local_audio_track.ssrc_ids = | |
1336 std::vector<std::string>({ "1", "2", "3" }); | |
1273 expected_local_audio_track.audio_level = 1.0; | 1337 expected_local_audio_track.audio_level = 1.0; |
1274 expected_local_audio_track.echo_return_loss = 42.0; | 1338 expected_local_audio_track.echo_return_loss = 42.0; |
1275 expected_local_audio_track.echo_return_loss_enhancement = 52.0; | 1339 expected_local_audio_track.echo_return_loss_enhancement = 52.0; |
1276 ASSERT_TRUE(report->Get(expected_local_audio_track.id())); | 1340 ASSERT_TRUE(report->Get(expected_local_audio_track.id())); |
1277 EXPECT_EQ(expected_local_audio_track, | 1341 EXPECT_EQ(expected_local_audio_track, |
1278 report->Get(expected_local_audio_track.id())->cast_to< | 1342 report->Get(expected_local_audio_track.id())->cast_to< |
1279 RTCMediaStreamTrackStats>()); | 1343 RTCMediaStreamTrackStats>()); |
1280 | 1344 |
1281 RTCMediaStreamTrackStats expected_remote_audio_track( | 1345 RTCMediaStreamTrackStats expected_remote_audio_track( |
1282 "RTCMediaStreamTrack_RemoteAudioTrackID", report->timestamp_us()); | 1346 "RTCMediaStreamTrack_remote_RemoteAudioTrackID", report->timestamp_us()); |
1283 expected_remote_audio_track.track_identifier = remote_audio_track->id(); | 1347 expected_remote_audio_track.track_identifier = remote_audio_track->id(); |
1284 expected_remote_audio_track.remote_source = true; | 1348 expected_remote_audio_track.remote_source = true; |
1285 expected_remote_audio_track.ended = false; | 1349 expected_remote_audio_track.ended = false; |
1286 expected_remote_audio_track.detached = false; | 1350 expected_remote_audio_track.detached = false; |
1351 expected_remote_audio_track.ssrc_ids = std::vector<std::string>({ "4" }); | |
1287 expected_remote_audio_track.audio_level = 0.0; | 1352 expected_remote_audio_track.audio_level = 0.0; |
1288 expected_remote_audio_track.echo_return_loss = 13.0; | 1353 expected_remote_audio_track.echo_return_loss = 13.0; |
1289 expected_remote_audio_track.echo_return_loss_enhancement = 37.0; | 1354 expected_remote_audio_track.echo_return_loss_enhancement = 37.0; |
1290 ASSERT_TRUE(report->Get(expected_remote_audio_track.id())); | 1355 ASSERT_TRUE(report->Get(expected_remote_audio_track.id())); |
1291 EXPECT_EQ(expected_remote_audio_track, | 1356 EXPECT_EQ(expected_remote_audio_track, |
1292 report->Get(expected_remote_audio_track.id())->cast_to< | 1357 report->Get(expected_remote_audio_track.id())->cast_to< |
1293 RTCMediaStreamTrackStats>()); | 1358 RTCMediaStreamTrackStats>()); |
1294 } | 1359 } |
1295 | 1360 |
1296 TEST_F(RTCStatsCollectorTest, | 1361 TEST_F(RTCStatsCollectorTest, |
(...skipping 15 matching lines...) Expand all Loading... | |
1312 FakeAudioTrackForStats::Create( | 1377 FakeAudioTrackForStats::Create( |
1313 "LocalAudioTrackID", | 1378 "LocalAudioTrackID", |
1314 MediaStreamTrackInterface::TrackState::kEnded, | 1379 MediaStreamTrackInterface::TrackState::kEnded, |
1315 32767, | 1380 32767, |
1316 new FakeAudioProcessorForStats(local_audio_processor_stats)); | 1381 new FakeAudioProcessorForStats(local_audio_processor_stats)); |
1317 local_stream->AddTrack(local_audio_track); | 1382 local_stream->AddTrack(local_audio_track); |
1318 | 1383 |
1319 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1384 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1320 | 1385 |
1321 RTCMediaStreamTrackStats expected_local_audio_track( | 1386 RTCMediaStreamTrackStats expected_local_audio_track( |
1322 "RTCMediaStreamTrack_LocalAudioTrackID", report->timestamp_us()); | 1387 "RTCMediaStreamTrack_local_LocalAudioTrackID", report->timestamp_us()); |
1323 expected_local_audio_track.track_identifier = local_audio_track->id(); | 1388 expected_local_audio_track.track_identifier = local_audio_track->id(); |
1324 expected_local_audio_track.remote_source = false; | 1389 expected_local_audio_track.remote_source = false; |
1325 expected_local_audio_track.ended = true; | 1390 expected_local_audio_track.ended = true; |
1326 expected_local_audio_track.detached = false; | 1391 expected_local_audio_track.detached = false; |
1327 expected_local_audio_track.audio_level = 1.0; | 1392 expected_local_audio_track.audio_level = 1.0; |
1328 // Should be undefined: |expected_local_audio_track.echo_return_loss| and | 1393 // Should be undefined: |expected_local_audio_track.echo_return_loss| and |
1329 // |expected_local_audio_track.echo_return_loss_enhancement|. | 1394 // |expected_local_audio_track.echo_return_loss_enhancement|. |
1330 ASSERT_TRUE(report->Get(expected_local_audio_track.id())); | 1395 ASSERT_TRUE(report->Get(expected_local_audio_track.id())); |
1331 EXPECT_EQ(expected_local_audio_track, | 1396 EXPECT_EQ(expected_local_audio_track, |
1332 report->Get(expected_local_audio_track.id())->cast_to< | 1397 report->Get(expected_local_audio_track.id())->cast_to< |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1370 remote_video_track_source_stats.input_height = 4321; | 1435 remote_video_track_source_stats.input_height = 4321; |
1371 rtc::scoped_refptr<FakeVideoTrackSourceForStats> remote_video_track_source = | 1436 rtc::scoped_refptr<FakeVideoTrackSourceForStats> remote_video_track_source = |
1372 new FakeVideoTrackSourceForStats(remote_video_track_source_stats); | 1437 new FakeVideoTrackSourceForStats(remote_video_track_source_stats); |
1373 rtc::scoped_refptr<FakeVideoTrackForStats> remote_video_track = | 1438 rtc::scoped_refptr<FakeVideoTrackForStats> remote_video_track = |
1374 FakeVideoTrackForStats::Create( | 1439 FakeVideoTrackForStats::Create( |
1375 "RemoteVideoTrackID", | 1440 "RemoteVideoTrackID", |
1376 MediaStreamTrackInterface::TrackState::kEnded, | 1441 MediaStreamTrackInterface::TrackState::kEnded, |
1377 remote_video_track_source); | 1442 remote_video_track_source); |
1378 remote_stream->AddTrack(remote_video_track); | 1443 remote_stream->AddTrack(remote_video_track); |
1379 | 1444 |
1445 // RTP sender/receivers for local/remote track to wire up SSRCs. | |
1446 std::vector<rtc::scoped_refptr<RtpSenderInterface>> rtp_senders; | |
1447 rtc::scoped_refptr<FakeRtpSender> rtp_sender = | |
1448 new FakeRtpSender(cricket::MEDIA_TYPE_VIDEO, | |
1449 CreateRtpParametersWithSsrc(42)); | |
1450 rtp_sender->SetTrack(local_video_track); | |
1451 rtp_senders.push_back(rtp_sender); | |
1452 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> rtp_receivers; | |
1453 rtc::scoped_refptr<FakeRtpReceiver> rtp_receiver = | |
1454 new FakeRtpReceiver(cricket::MEDIA_TYPE_VIDEO, | |
1455 CreateRtpParametersWithSsrc(43)); | |
1456 rtp_receiver->SetTrack(remote_video_track); | |
1457 rtp_receivers.push_back(rtp_receiver); | |
1458 EXPECT_CALL(test_->pc(), GetSenders()).WillRepeatedly( | |
1459 Return(rtp_senders)); | |
1460 EXPECT_CALL(test_->pc(), GetReceivers()).WillRepeatedly( | |
1461 Return(rtp_receivers)); | |
1462 | |
1463 // |VideoMediaInfo| for the above referenced SSRCs | |
1464 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); | |
1465 cricket::VideoChannel video_channel( | |
1466 test_->worker_thread(), test_->network_thread(), video_media_channel, | |
1467 nullptr, "VideoContentName", kDefaultRtcpEnabled, kDefaultSrtpRequired); | |
1468 cricket::VideoMediaInfo video_media_info; | |
1469 video_media_info.senders.push_back(cricket::VideoSenderInfo()); | |
1470 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | |
1471 video_media_info.senders[0].local_stats[0].ssrc = 42; | |
1472 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); | |
1473 video_media_info.receivers[0].local_stats.push_back( | |
1474 cricket::SsrcReceiverInfo()); | |
1475 video_media_info.receivers[0].local_stats[0].ssrc = 43; | |
1476 video_media_info.receivers[0].local_stats.push_back( | |
1477 cricket::SsrcReceiverInfo()); | |
1478 video_media_info.receivers[0].local_stats[1].ssrc = 44; | |
1479 EXPECT_CALL(*video_media_channel, GetStats(_)) | |
1480 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | |
1481 SessionStats session_stats; | |
1482 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | |
1483 session_stats.transport_stats["TransportName"].transport_name = | |
1484 "TransportName"; | |
1485 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( | |
1486 [&session_stats](const ChannelNamePairs&) { | |
1487 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); | |
1488 })); | |
1489 EXPECT_CALL(test_->session(), video_channel()) | |
1490 .WillRepeatedly(Return(&video_channel)); | |
1491 | |
1380 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1492 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1381 | 1493 |
1382 RTCMediaStreamStats expected_local_stream( | 1494 RTCMediaStreamStats expected_local_stream( |
1383 "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us()); | 1495 "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us()); |
1384 expected_local_stream.stream_identifier = local_stream->label(); | 1496 expected_local_stream.stream_identifier = local_stream->label(); |
1385 expected_local_stream.track_ids = std::vector<std::string>(); | 1497 expected_local_stream.track_ids = std::vector<std::string>(); |
1386 expected_local_stream.track_ids->push_back( | 1498 expected_local_stream.track_ids->push_back( |
1387 "RTCMediaStreamTrack_LocalVideoTrackID"); | 1499 "RTCMediaStreamTrack_local_LocalVideoTrackID"); |
1388 ASSERT_TRUE(report->Get(expected_local_stream.id())); | 1500 ASSERT_TRUE(report->Get(expected_local_stream.id())); |
1389 EXPECT_EQ(expected_local_stream, | 1501 EXPECT_EQ(expected_local_stream, |
1390 report->Get(expected_local_stream.id())->cast_to< | 1502 report->Get(expected_local_stream.id())->cast_to< |
1391 RTCMediaStreamStats>()); | 1503 RTCMediaStreamStats>()); |
1392 | 1504 |
1393 RTCMediaStreamStats expected_remote_stream( | 1505 RTCMediaStreamStats expected_remote_stream( |
1394 "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us()); | 1506 "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us()); |
1395 expected_remote_stream.stream_identifier = remote_stream->label(); | 1507 expected_remote_stream.stream_identifier = remote_stream->label(); |
1396 expected_remote_stream.track_ids = std::vector<std::string>(); | 1508 expected_remote_stream.track_ids = std::vector<std::string>(); |
1397 expected_remote_stream.track_ids->push_back( | 1509 expected_remote_stream.track_ids->push_back( |
1398 "RTCMediaStreamTrack_RemoteVideoTrackID"); | 1510 "RTCMediaStreamTrack_remote_RemoteVideoTrackID"); |
1399 ASSERT_TRUE(report->Get(expected_remote_stream.id())); | 1511 ASSERT_TRUE(report->Get(expected_remote_stream.id())); |
1400 EXPECT_EQ(expected_remote_stream, | 1512 EXPECT_EQ(expected_remote_stream, |
1401 report->Get(expected_remote_stream.id())->cast_to< | 1513 report->Get(expected_remote_stream.id())->cast_to< |
1402 RTCMediaStreamStats>()); | 1514 RTCMediaStreamStats>()); |
1403 | 1515 |
1404 RTCMediaStreamTrackStats expected_local_video_track( | 1516 RTCMediaStreamTrackStats expected_local_video_track( |
1405 "RTCMediaStreamTrack_LocalVideoTrackID", report->timestamp_us()); | 1517 "RTCMediaStreamTrack_local_LocalVideoTrackID", report->timestamp_us()); |
1406 expected_local_video_track.track_identifier = local_video_track->id(); | 1518 expected_local_video_track.track_identifier = local_video_track->id(); |
1407 expected_local_video_track.remote_source = false; | 1519 expected_local_video_track.remote_source = false; |
1408 expected_local_video_track.ended = false; | 1520 expected_local_video_track.ended = false; |
1409 expected_local_video_track.detached = false; | 1521 expected_local_video_track.detached = false; |
1522 expected_local_video_track.ssrc_ids = std::vector<std::string>({ "42" }); | |
1410 expected_local_video_track.frame_width = 1234; | 1523 expected_local_video_track.frame_width = 1234; |
1411 expected_local_video_track.frame_height = 4321; | 1524 expected_local_video_track.frame_height = 4321; |
1412 ASSERT_TRUE(report->Get(expected_local_video_track.id())); | 1525 ASSERT_TRUE(report->Get(expected_local_video_track.id())); |
1413 EXPECT_EQ(expected_local_video_track, | 1526 EXPECT_EQ(expected_local_video_track, |
1414 report->Get(expected_local_video_track.id())->cast_to< | 1527 report->Get(expected_local_video_track.id())->cast_to< |
1415 RTCMediaStreamTrackStats>()); | 1528 RTCMediaStreamTrackStats>()); |
1416 | 1529 |
1417 RTCMediaStreamTrackStats expected_remote_video_track( | 1530 RTCMediaStreamTrackStats expected_remote_video_track( |
1418 "RTCMediaStreamTrack_RemoteVideoTrackID", report->timestamp_us()); | 1531 "RTCMediaStreamTrack_remote_RemoteVideoTrackID", report->timestamp_us()); |
1419 expected_remote_video_track.track_identifier = remote_video_track->id(); | 1532 expected_remote_video_track.track_identifier = remote_video_track->id(); |
1420 expected_remote_video_track.remote_source = true; | 1533 expected_remote_video_track.remote_source = true; |
1421 expected_remote_video_track.ended = true; | 1534 expected_remote_video_track.ended = true; |
1422 expected_remote_video_track.detached = false; | 1535 expected_remote_video_track.detached = false; |
1536 expected_remote_video_track.ssrc_ids = | |
1537 std::vector<std::string>({ "43", "44" }); | |
1423 expected_remote_video_track.frame_width = 1234; | 1538 expected_remote_video_track.frame_width = 1234; |
1424 expected_remote_video_track.frame_height = 4321; | 1539 expected_remote_video_track.frame_height = 4321; |
1425 ASSERT_TRUE(report->Get(expected_remote_video_track.id())); | 1540 ASSERT_TRUE(report->Get(expected_remote_video_track.id())); |
1426 EXPECT_EQ(expected_remote_video_track, | 1541 EXPECT_EQ(expected_remote_video_track, |
1427 report->Get(expected_remote_video_track.id())->cast_to< | 1542 report->Get(expected_remote_video_track.id())->cast_to< |
1428 RTCMediaStreamTrackStats>()); | 1543 RTCMediaStreamTrackStats>()); |
1429 } | 1544 } |
1430 | 1545 |
1431 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { | 1546 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { |
1432 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | 1547 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1986 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 2101 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
1987 }; | 2102 }; |
1988 | 2103 |
1989 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 2104 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
1990 collector_->VerifyThreadUsageAndResultsMerging(); | 2105 collector_->VerifyThreadUsageAndResultsMerging(); |
1991 } | 2106 } |
1992 | 2107 |
1993 } // namespace | 2108 } // namespace |
1994 | 2109 |
1995 } // namespace webrtc | 2110 } // namespace webrtc |
OLD | NEW |