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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 1932 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
1933 EXPECT_CALL(*media_channel, GetStats(_)) | 1933 EXPECT_CALL(*media_channel, GetStats(_)) |
1934 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); | 1934 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
1935 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 1935 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
1936 stats.GetStats(NULL, &reports); | 1936 stats.GetStats(NULL, &reports); |
1937 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded), | 1937 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded), |
1938 ExtractSsrcStatsValue(reports, | 1938 ExtractSsrcStatsValue(reports, |
1939 StatsReport::kStatsValueNameFramesEncoded)); | 1939 StatsReport::kStatsValueNameFramesEncoded)); |
1940 } | 1940 } |
1941 | 1941 |
| 1942 // This test verifies that stats are correctly set in video receive ssrc stats. |
| 1943 TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) { |
| 1944 StatsCollectorForTest stats(&pc_); |
| 1945 |
| 1946 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
| 1947 .WillRepeatedly(Return(false)); |
| 1948 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) |
| 1949 .WillRepeatedly(Return(nullptr)); |
| 1950 |
| 1951 const char kVideoChannelName[] = "video"; |
| 1952 |
| 1953 InitSessionStats(kVideoChannelName); |
| 1954 EXPECT_CALL(session_, GetTransportStats(_)) |
| 1955 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), Return(true))); |
| 1956 |
| 1957 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
| 1958 cricket::VideoChannel video_channel(worker_thread_, network_thread_, |
| 1959 media_channel, nullptr, kVideoChannelName, |
| 1960 false); |
| 1961 StatsReports reports; // returned values. |
| 1962 cricket::VideoReceiverInfo video_receiver_info; |
| 1963 cricket::VideoMediaInfo stats_read; |
| 1964 |
| 1965 AddIncomingVideoTrackStats(); |
| 1966 stats.AddStream(stream_); |
| 1967 |
| 1968 // Construct a stats value to read. |
| 1969 video_receiver_info.add_ssrc(1234); |
| 1970 video_receiver_info.frames_decoded = 10; |
| 1971 stats_read.receivers.push_back(video_receiver_info); |
| 1972 |
| 1973 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); |
| 1974 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
| 1975 EXPECT_CALL(*media_channel, GetStats(_)) |
| 1976 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
| 1977 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
| 1978 stats.GetStats(NULL, &reports); |
| 1979 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), |
| 1980 ExtractSsrcStatsValue(reports, |
| 1981 StatsReport::kStatsValueNameFramesDecoded)); |
| 1982 } |
| 1983 |
1942 } // namespace webrtc | 1984 } // namespace webrtc |
OLD | NEW |