OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 const int64_t kBytesSent = 12345678901234LL; | 931 const int64_t kBytesSent = 12345678901234LL; |
932 const std::string kBytesSentString("12345678901234"); | 932 const std::string kBytesSentString("12345678901234"); |
933 | 933 |
934 AddOutgoingVideoTrackStats(); | 934 AddOutgoingVideoTrackStats(); |
935 stats.AddStream(stream_); | 935 stats.AddStream(stream_); |
936 | 936 |
937 // Construct a stats value to read. | 937 // Construct a stats value to read. |
938 video_sender_info.add_ssrc(1234); | 938 video_sender_info.add_ssrc(1234); |
939 video_sender_info.bytes_sent = kBytesSent; | 939 video_sender_info.bytes_sent = kBytesSent; |
940 stats_read.senders.push_back(video_sender_info); | 940 stats_read.senders.push_back(video_sender_info); |
| 941 cricket::BandwidthEstimationInfo bwe; |
| 942 const int kTargetEncBitrate = 123456; |
| 943 const std::string kTargetEncBitrateString("123456"); |
| 944 bwe.target_enc_bitrate = kTargetEncBitrate; |
| 945 stats_read.bw_estimations.push_back(bwe); |
941 | 946 |
942 webrtc::Call::Stats call_stats; | |
943 const int kSendBandwidth = 1234567; | |
944 const int kRecvBandwidth = 12345678; | |
945 const int kPacerDelay = 123; | |
946 call_stats.send_bandwidth_bps = kSendBandwidth; | |
947 call_stats.recv_bandwidth_bps = kRecvBandwidth; | |
948 call_stats.pacer_delay_ms = kPacerDelay; | |
949 EXPECT_CALL(session_, GetCallStats()).WillRepeatedly(Return(call_stats)); | |
950 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); | 947 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); |
951 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 948 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
952 EXPECT_CALL(*media_channel, GetStats(_)) | 949 EXPECT_CALL(*media_channel, GetStats(_)) |
953 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); | 950 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
954 | 951 |
955 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 952 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
956 stats.GetStats(NULL, &reports); | 953 stats.GetStats(NULL, &reports); |
957 std::string result = ExtractSsrcStatsValue(reports, | 954 std::string result = ExtractSsrcStatsValue(reports, |
958 StatsReport::kStatsValueNameBytesSent); | 955 StatsReport::kStatsValueNameBytesSent); |
959 EXPECT_EQ(kBytesSentString, result); | 956 EXPECT_EQ(kBytesSentString, result); |
960 result = ExtractBweStatsValue( | 957 result = ExtractBweStatsValue(reports, |
961 reports, StatsReport::kStatsValueNameAvailableSendBandwidth); | 958 StatsReport::kStatsValueNameTargetEncBitrate); |
962 EXPECT_EQ(rtc::ToString(kSendBandwidth), result); | 959 EXPECT_EQ(kTargetEncBitrateString, result); |
963 result = ExtractBweStatsValue( | |
964 reports, StatsReport::kStatsValueNameAvailableReceiveBandwidth); | |
965 EXPECT_EQ(rtc::ToString(kRecvBandwidth), result); | |
966 result = | |
967 ExtractBweStatsValue(reports, StatsReport::kStatsValueNameBucketDelay); | |
968 EXPECT_EQ(rtc::ToString(kPacerDelay), result); | |
969 } | 960 } |
970 | 961 |
971 // This test verifies that an object of type "googSession" always | 962 // This test verifies that an object of type "googSession" always |
972 // exists in the returned stats. | 963 // exists in the returned stats. |
973 TEST_F(StatsCollectorTest, SessionObjectExists) { | 964 TEST_F(StatsCollectorTest, SessionObjectExists) { |
974 StatsCollectorForTest stats(&pc_); | 965 StatsCollectorForTest stats(&pc_); |
975 | 966 |
976 StatsReports reports; // returned values. | 967 StatsReports reports; // returned values. |
977 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 968 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
978 stats.GetStats(NULL, &reports); | 969 stats.GetStats(NULL, &reports); |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 2025 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
2035 stats.GetStats(NULL, &reports); | 2026 stats.GetStats(NULL, &reports); |
2036 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), | 2027 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), |
2037 ExtractSsrcStatsValue(reports, | 2028 ExtractSsrcStatsValue(reports, |
2038 StatsReport::kStatsValueNameFramesDecoded)); | 2029 StatsReport::kStatsValueNameFramesDecoded)); |
2039 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), | 2030 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), |
2040 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); | 2031 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); |
2041 } | 2032 } |
2042 | 2033 |
2043 } // namespace webrtc | 2034 } // namespace webrtc |
OLD | NEW |