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

Side by Side Diff: webrtc/api/rtcstatscollector_unittest.cc

Issue 2602033002: RTCMediaStreamTrackStats.frameWidth/Height,framesPerSecond,framesDecoded (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 .WillRepeatedly(Return(remote_streams)); 1410 .WillRepeatedly(Return(remote_streams));
1411 1411
1412 rtc::scoped_refptr<MediaStream> local_stream = 1412 rtc::scoped_refptr<MediaStream> local_stream =
1413 MediaStream::Create("LocalStreamLabel"); 1413 MediaStream::Create("LocalStreamLabel");
1414 local_streams->AddStream(local_stream); 1414 local_streams->AddStream(local_stream);
1415 rtc::scoped_refptr<MediaStream> remote_stream = 1415 rtc::scoped_refptr<MediaStream> remote_stream =
1416 MediaStream::Create("RemoteStreamLabel"); 1416 MediaStream::Create("RemoteStreamLabel");
1417 remote_streams->AddStream(remote_stream); 1417 remote_streams->AddStream(remote_stream);
1418 1418
1419 // Local video track 1419 // Local video track
1420 VideoTrackSourceInterface::Stats local_video_track_source_stats;
1421 local_video_track_source_stats.input_width = 1234;
1422 local_video_track_source_stats.input_height = 4321;
1423 rtc::scoped_refptr<FakeVideoTrackSourceForStats> local_video_track_source =
1424 new FakeVideoTrackSourceForStats(local_video_track_source_stats);
1425 rtc::scoped_refptr<FakeVideoTrackForStats> local_video_track = 1420 rtc::scoped_refptr<FakeVideoTrackForStats> local_video_track =
1426 FakeVideoTrackForStats::Create( 1421 FakeVideoTrackForStats::Create(
1427 "LocalVideoTrackID", 1422 "LocalVideoTrackID",
1428 MediaStreamTrackInterface::TrackState::kLive, 1423 MediaStreamTrackInterface::TrackState::kLive,
1429 local_video_track_source); 1424 nullptr);
1430 local_stream->AddTrack(local_video_track); 1425 local_stream->AddTrack(local_video_track);
1431 1426
1432 // Remote video track 1427 // Remote video track
1433 VideoTrackSourceInterface::Stats remote_video_track_source_stats;
1434 remote_video_track_source_stats.input_width = 1234;
1435 remote_video_track_source_stats.input_height = 4321;
1436 rtc::scoped_refptr<FakeVideoTrackSourceForStats> remote_video_track_source =
1437 new FakeVideoTrackSourceForStats(remote_video_track_source_stats);
1438 rtc::scoped_refptr<FakeVideoTrackForStats> remote_video_track = 1428 rtc::scoped_refptr<FakeVideoTrackForStats> remote_video_track =
1439 FakeVideoTrackForStats::Create( 1429 FakeVideoTrackForStats::Create(
1440 "RemoteVideoTrackID", 1430 "RemoteVideoTrackID",
1441 MediaStreamTrackInterface::TrackState::kEnded, 1431 MediaStreamTrackInterface::TrackState::kEnded,
1442 remote_video_track_source); 1432 nullptr);
1443 remote_stream->AddTrack(remote_video_track); 1433 remote_stream->AddTrack(remote_video_track);
1444 1434
1445 // RTP sender/receivers for local/remote track to wire up SSRCs. 1435 // RTP sender/receivers for local/remote track to wire up SSRCs.
1446 std::vector<rtc::scoped_refptr<RtpSenderInterface>> rtp_senders; 1436 std::vector<rtc::scoped_refptr<RtpSenderInterface>> rtp_senders;
1447 rtc::scoped_refptr<FakeRtpSender> rtp_sender = 1437 rtc::scoped_refptr<FakeRtpSender> rtp_sender =
1448 new FakeRtpSender(cricket::MEDIA_TYPE_VIDEO, 1438 new FakeRtpSender(cricket::MEDIA_TYPE_VIDEO,
1449 CreateRtpParametersWithSsrc(42)); 1439 CreateRtpParametersWithSsrc(42));
1450 rtp_sender->SetTrack(local_video_track); 1440 rtp_sender->SetTrack(local_video_track);
1451 rtp_senders.push_back(rtp_sender); 1441 rtp_senders.push_back(rtp_sender);
1452 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> rtp_receivers; 1442 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> rtp_receivers;
1453 rtc::scoped_refptr<FakeRtpReceiver> rtp_receiver = 1443 rtc::scoped_refptr<FakeRtpReceiver> rtp_receiver =
1454 new FakeRtpReceiver(cricket::MEDIA_TYPE_VIDEO, 1444 new FakeRtpReceiver(cricket::MEDIA_TYPE_VIDEO,
1455 CreateRtpParametersWithSsrc(43)); 1445 CreateRtpParametersWithSsrc(43));
1456 rtp_receiver->SetTrack(remote_video_track); 1446 rtp_receiver->SetTrack(remote_video_track);
1457 rtp_receivers.push_back(rtp_receiver); 1447 rtp_receivers.push_back(rtp_receiver);
1458 EXPECT_CALL(test_->pc(), GetSenders()).WillRepeatedly( 1448 EXPECT_CALL(test_->pc(), GetSenders()).WillRepeatedly(
1459 Return(rtp_senders)); 1449 Return(rtp_senders));
1460 EXPECT_CALL(test_->pc(), GetReceivers()).WillRepeatedly( 1450 EXPECT_CALL(test_->pc(), GetReceivers()).WillRepeatedly(
1461 Return(rtp_receivers)); 1451 Return(rtp_receivers));
1462 1452
1463 // |VideoMediaInfo| for the above referenced SSRCs 1453 // |VideoMediaInfo| for the above referenced SSRCs
1464 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); 1454 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel();
1465 cricket::VideoChannel video_channel( 1455 cricket::VideoChannel video_channel(
1466 test_->worker_thread(), test_->network_thread(), video_media_channel, 1456 test_->worker_thread(), test_->network_thread(), video_media_channel,
1467 nullptr, "VideoContentName", kDefaultRtcpEnabled, kDefaultSrtpRequired); 1457 nullptr, "VideoContentName", kDefaultRtcpEnabled, kDefaultSrtpRequired);
1468 cricket::VideoMediaInfo video_media_info; 1458 cricket::VideoMediaInfo video_media_info;
1469 video_media_info.senders.push_back(cricket::VideoSenderInfo()); 1459 video_media_info.senders.push_back(cricket::VideoSenderInfo());
1470 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); 1460 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo());
1471 video_media_info.senders[0].local_stats[0].ssrc = 42; 1461 video_media_info.senders[0].local_stats[0].ssrc = 42;
1462 video_media_info.senders[0].send_frame_width = 1234;
1463 video_media_info.senders[0].send_frame_height = 4321;
1464 video_media_info.senders[0].framerate_sent = 55;
1472 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); 1465 video_media_info.receivers.push_back(cricket::VideoReceiverInfo());
1473 video_media_info.receivers[0].local_stats.push_back( 1466 video_media_info.receivers[0].local_stats.push_back(
1474 cricket::SsrcReceiverInfo()); 1467 cricket::SsrcReceiverInfo());
1475 video_media_info.receivers[0].local_stats[0].ssrc = 43; 1468 video_media_info.receivers[0].local_stats[0].ssrc = 43;
1476 video_media_info.receivers[0].local_stats.push_back( 1469 video_media_info.receivers[0].local_stats.push_back(
1477 cricket::SsrcReceiverInfo()); 1470 cricket::SsrcReceiverInfo());
1478 video_media_info.receivers[0].local_stats[1].ssrc = 44; 1471 video_media_info.receivers[0].local_stats[1].ssrc = 44;
1472 video_media_info.receivers[0].frame_width = 4321;
1473 video_media_info.receivers[0].frame_height = 1234;
1474 video_media_info.receivers[0].framerate_output = 66;
1475 video_media_info.receivers[0].frames_decoded = 1337;
1479 EXPECT_CALL(*video_media_channel, GetStats(_)) 1476 EXPECT_CALL(*video_media_channel, GetStats(_))
1480 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); 1477 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true)));
1481 SessionStats session_stats; 1478 SessionStats session_stats;
1482 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; 1479 session_stats.proxy_to_transport["VideoContentName"] = "TransportName";
1483 session_stats.transport_stats["TransportName"].transport_name = 1480 session_stats.transport_stats["TransportName"].transport_name =
1484 "TransportName"; 1481 "TransportName";
1485 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( 1482 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke(
1486 [&session_stats](const ChannelNamePairs&) { 1483 [&session_stats](const ChannelNamePairs&) {
1487 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); 1484 return std::unique_ptr<SessionStats>(new SessionStats(session_stats));
1488 })); 1485 }));
(...skipping 26 matching lines...) Expand all
1515 1512
1516 RTCMediaStreamTrackStats expected_local_video_track( 1513 RTCMediaStreamTrackStats expected_local_video_track(
1517 "RTCMediaStreamTrack_local_LocalVideoTrackID", report->timestamp_us()); 1514 "RTCMediaStreamTrack_local_LocalVideoTrackID", report->timestamp_us());
1518 expected_local_video_track.track_identifier = local_video_track->id(); 1515 expected_local_video_track.track_identifier = local_video_track->id();
1519 expected_local_video_track.remote_source = false; 1516 expected_local_video_track.remote_source = false;
1520 expected_local_video_track.ended = false; 1517 expected_local_video_track.ended = false;
1521 expected_local_video_track.detached = false; 1518 expected_local_video_track.detached = false;
1522 expected_local_video_track.ssrc_ids = std::vector<std::string>({ "42" }); 1519 expected_local_video_track.ssrc_ids = std::vector<std::string>({ "42" });
1523 expected_local_video_track.frame_width = 1234; 1520 expected_local_video_track.frame_width = 1234;
1524 expected_local_video_track.frame_height = 4321; 1521 expected_local_video_track.frame_height = 4321;
1522 expected_local_video_track.frames_per_second = 55.0;
1525 ASSERT_TRUE(report->Get(expected_local_video_track.id())); 1523 ASSERT_TRUE(report->Get(expected_local_video_track.id()));
1526 EXPECT_EQ(expected_local_video_track, 1524 EXPECT_EQ(expected_local_video_track,
1527 report->Get(expected_local_video_track.id())->cast_to< 1525 report->Get(expected_local_video_track.id())->cast_to<
1528 RTCMediaStreamTrackStats>()); 1526 RTCMediaStreamTrackStats>());
1529 1527
1530 RTCMediaStreamTrackStats expected_remote_video_track( 1528 RTCMediaStreamTrackStats expected_remote_video_track(
1531 "RTCMediaStreamTrack_remote_RemoteVideoTrackID", report->timestamp_us()); 1529 "RTCMediaStreamTrack_remote_RemoteVideoTrackID", report->timestamp_us());
1532 expected_remote_video_track.track_identifier = remote_video_track->id(); 1530 expected_remote_video_track.track_identifier = remote_video_track->id();
1533 expected_remote_video_track.remote_source = true; 1531 expected_remote_video_track.remote_source = true;
1534 expected_remote_video_track.ended = true; 1532 expected_remote_video_track.ended = true;
1535 expected_remote_video_track.detached = false; 1533 expected_remote_video_track.detached = false;
1536 expected_remote_video_track.ssrc_ids = 1534 expected_remote_video_track.ssrc_ids =
1537 std::vector<std::string>({ "43", "44" }); 1535 std::vector<std::string>({ "43", "44" });
1538 expected_remote_video_track.frame_width = 1234; 1536 expected_remote_video_track.frame_width = 4321;
1539 expected_remote_video_track.frame_height = 4321; 1537 expected_remote_video_track.frame_height = 1234;
1538 expected_remote_video_track.frames_per_second = 66.0;
1539 expected_remote_video_track.frames_decoded = 1337;
1540 ASSERT_TRUE(report->Get(expected_remote_video_track.id())); 1540 ASSERT_TRUE(report->Get(expected_remote_video_track.id()));
1541 EXPECT_EQ(expected_remote_video_track, 1541 EXPECT_EQ(expected_remote_video_track,
1542 report->Get(expected_remote_video_track.id())->cast_to< 1542 report->Get(expected_remote_video_track.id())->cast_to<
1543 RTCMediaStreamTrackStats>()); 1543 RTCMediaStreamTrackStats>());
1544 } 1544 }
1545 1545
1546 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { 1546 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
1547 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); 1547 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel();
1548 cricket::VoiceChannel voice_channel( 1548 cricket::VoiceChannel voice_channel(
1549 test_->worker_thread(), test_->network_thread(), test_->media_engine(), 1549 test_->worker_thread(), test_->network_thread(), test_->media_engine(),
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; 2101 rtc::scoped_refptr<FakeRTCStatsCollector> collector_;
2102 }; 2102 };
2103 2103
2104 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { 2104 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) {
2105 collector_->VerifyThreadUsageAndResultsMerging(); 2105 collector_->VerifyThreadUsageAndResultsMerging();
2106 } 2106 }
2107 2107
2108 } // namespace 2108 } // namespace
2109 2109
2110 } // namespace webrtc 2110 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698