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 11 matching lines...) Expand all Loading... |
22 #include "webrtc/api/peerconnectionfactory.h" | 22 #include "webrtc/api/peerconnectionfactory.h" |
23 #include "webrtc/api/test/fakedatachannelprovider.h" | 23 #include "webrtc/api/test/fakedatachannelprovider.h" |
24 #include "webrtc/api/test/fakevideotracksource.h" | 24 #include "webrtc/api/test/fakevideotracksource.h" |
25 #include "webrtc/api/test/mock_peerconnection.h" | 25 #include "webrtc/api/test/mock_peerconnection.h" |
26 #include "webrtc/api/test/mock_webrtcsession.h" | 26 #include "webrtc/api/test/mock_webrtcsession.h" |
27 #include "webrtc/api/videotrack.h" | 27 #include "webrtc/api/videotrack.h" |
28 #include "webrtc/base/base64.h" | 28 #include "webrtc/base/base64.h" |
29 #include "webrtc/base/fakesslidentity.h" | 29 #include "webrtc/base/fakesslidentity.h" |
30 #include "webrtc/base/gunit.h" | 30 #include "webrtc/base/gunit.h" |
31 #include "webrtc/base/network.h" | 31 #include "webrtc/base/network.h" |
| 32 #include "webrtc/base/stringencode.h" |
32 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 33 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
33 #include "webrtc/media/base/fakemediaengine.h" | 34 #include "webrtc/media/base/fakemediaengine.h" |
34 #include "webrtc/media/base/test/mock_mediachannel.h" | 35 #include "webrtc/media/base/test/mock_mediachannel.h" |
35 #include "webrtc/p2p/base/faketransportcontroller.h" | 36 #include "webrtc/p2p/base/faketransportcontroller.h" |
36 #include "webrtc/pc/channelmanager.h" | 37 #include "webrtc/pc/channelmanager.h" |
37 #include "webrtc/test/gmock.h" | 38 #include "webrtc/test/gmock.h" |
38 #include "webrtc/test/gtest.h" | 39 #include "webrtc/test/gtest.h" |
39 | 40 |
40 using testing::_; | 41 using testing::_; |
41 using testing::DoAll; | 42 using testing::DoAll; |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 stats.ClearUpdateStatsCacheForTest(); | 1885 stats.ClearUpdateStatsCacheForTest(); |
1885 cricket::VoiceSenderInfo new_voice_sender_info; | 1886 cricket::VoiceSenderInfo new_voice_sender_info; |
1886 InitVoiceSenderInfo(&new_voice_sender_info); | 1887 InitVoiceSenderInfo(&new_voice_sender_info); |
1887 cricket::VoiceMediaInfo new_stats_read; | 1888 cricket::VoiceMediaInfo new_stats_read; |
1888 reports.clear(); | 1889 reports.clear(); |
1889 SetupAndVerifyAudioTrackStats( | 1890 SetupAndVerifyAudioTrackStats( |
1890 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1891 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1891 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1892 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1892 } | 1893 } |
1893 | 1894 |
| 1895 // This test verifies that stats are correctly set in video send ssrc stats. |
| 1896 TEST_F(StatsCollectorTest, VerifyVideoSendSsrcStats) { |
| 1897 StatsCollectorForTest stats(&pc_); |
| 1898 |
| 1899 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
| 1900 .WillRepeatedly(Return(false)); |
| 1901 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) |
| 1902 .WillRepeatedly(Return(nullptr)); |
| 1903 |
| 1904 const char kVideoChannelName[] = "video"; |
| 1905 |
| 1906 InitSessionStats(kVideoChannelName); |
| 1907 EXPECT_CALL(session_, GetTransportStats(_)) |
| 1908 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), Return(true))); |
| 1909 |
| 1910 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
| 1911 cricket::VideoChannel video_channel(worker_thread_, network_thread_, |
| 1912 media_channel, nullptr, kVideoChannelName, |
| 1913 false); |
| 1914 StatsReports reports; // returned values. |
| 1915 cricket::VideoSenderInfo video_sender_info; |
| 1916 cricket::VideoMediaInfo stats_read; |
| 1917 |
| 1918 AddOutgoingVideoTrackStats(); |
| 1919 stats.AddStream(stream_); |
| 1920 |
| 1921 // Construct a stats value to read. |
| 1922 video_sender_info.add_ssrc(1234); |
| 1923 video_sender_info.frames_encoded = 10; |
| 1924 stats_read.senders.push_back(video_sender_info); |
| 1925 |
| 1926 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); |
| 1927 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
| 1928 EXPECT_CALL(*media_channel, GetStats(_)) |
| 1929 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
| 1930 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
| 1931 stats.GetStats(NULL, &reports); |
| 1932 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded), |
| 1933 ExtractSsrcStatsValue(reports, |
| 1934 StatsReport::kStatsValueNameFramesEncoded)); |
| 1935 } |
| 1936 |
1894 } // namespace webrtc | 1937 } // namespace webrtc |
OLD | NEW |