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); | |
946 | 941 |
| 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)); |
947 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); | 950 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); |
948 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 951 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
949 EXPECT_CALL(*media_channel, GetStats(_)) | 952 EXPECT_CALL(*media_channel, GetStats(_)) |
950 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); | 953 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
951 | 954 |
952 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 955 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
953 stats.GetStats(NULL, &reports); | 956 stats.GetStats(NULL, &reports); |
954 std::string result = ExtractSsrcStatsValue(reports, | 957 std::string result = ExtractSsrcStatsValue(reports, |
955 StatsReport::kStatsValueNameBytesSent); | 958 StatsReport::kStatsValueNameBytesSent); |
956 EXPECT_EQ(kBytesSentString, result); | 959 EXPECT_EQ(kBytesSentString, result); |
957 result = ExtractBweStatsValue(reports, | 960 result = ExtractBweStatsValue( |
958 StatsReport::kStatsValueNameTargetEncBitrate); | 961 reports, StatsReport::kStatsValueNameAvailableSendBandwidth); |
959 EXPECT_EQ(kTargetEncBitrateString, result); | 962 EXPECT_EQ(rtc::ToString(kSendBandwidth), 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); |
960 } | 969 } |
961 | 970 |
962 // This test verifies that an object of type "googSession" always | 971 // This test verifies that an object of type "googSession" always |
963 // exists in the returned stats. | 972 // exists in the returned stats. |
964 TEST_F(StatsCollectorTest, SessionObjectExists) { | 973 TEST_F(StatsCollectorTest, SessionObjectExists) { |
965 StatsCollectorForTest stats(&pc_); | 974 StatsCollectorForTest stats(&pc_); |
966 | 975 |
967 StatsReports reports; // returned values. | 976 StatsReports reports; // returned values. |
968 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 977 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
969 stats.GetStats(NULL, &reports); | 978 stats.GetStats(NULL, &reports); |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 2034 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
2026 stats.GetStats(NULL, &reports); | 2035 stats.GetStats(NULL, &reports); |
2027 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), | 2036 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), |
2028 ExtractSsrcStatsValue(reports, | 2037 ExtractSsrcStatsValue(reports, |
2029 StatsReport::kStatsValueNameFramesDecoded)); | 2038 StatsReport::kStatsValueNameFramesDecoded)); |
2030 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), | 2039 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), |
2031 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); | 2040 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); |
2032 } | 2041 } |
2033 | 2042 |
2034 } // namespace webrtc | 2043 } // namespace webrtc |
OLD | NEW |