| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 27 matching lines...) Expand all Loading... |
| 38 max_delay_ms_(0) {} | 38 max_delay_ms_(0) {} |
| 39 virtual ~SendStatisticsProxyTest() {} | 39 virtual ~SendStatisticsProxyTest() {} |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 virtual void SetUp() { | 42 virtual void SetUp() { |
| 43 metrics::Reset(); | 43 metrics::Reset(); |
| 44 statistics_proxy_.reset(new SendStatisticsProxy( | 44 statistics_proxy_.reset(new SendStatisticsProxy( |
| 45 &fake_clock_, GetTestConfig(), | 45 &fake_clock_, GetTestConfig(), |
| 46 VideoEncoderConfig::ContentType::kRealtimeVideo)); | 46 VideoEncoderConfig::ContentType::kRealtimeVideo)); |
| 47 expected_ = VideoSendStream::Stats(); | 47 expected_ = VideoSendStream::Stats(); |
| 48 for (const auto& ssrc : config_.rtp.ssrcs) |
| 49 expected_.substreams[ssrc].is_rtx = false; |
| 50 for (const auto& ssrc : config_.rtp.rtx.ssrcs) |
| 51 expected_.substreams[ssrc].is_rtx = true; |
| 48 } | 52 } |
| 49 | 53 |
| 50 VideoSendStream::Config GetTestConfig() { | 54 VideoSendStream::Config GetTestConfig() { |
| 51 VideoSendStream::Config config(nullptr); | 55 VideoSendStream::Config config(nullptr); |
| 52 config.rtp.ssrcs.push_back(kFirstSsrc); | 56 config.rtp.ssrcs.push_back(kFirstSsrc); |
| 53 config.rtp.ssrcs.push_back(kSecondSsrc); | 57 config.rtp.ssrcs.push_back(kSecondSsrc); |
| 54 config.rtp.rtx.ssrcs.push_back(kFirstRtxSsrc); | 58 config.rtp.rtx.ssrcs.push_back(kFirstRtxSsrc); |
| 55 config.rtp.rtx.ssrcs.push_back(kSecondRtxSsrc); | 59 config.rtp.rtx.ssrcs.push_back(kSecondRtxSsrc); |
| 56 config.rtp.fec.red_payload_type = 17; | 60 config.rtp.fec.red_payload_type = 17; |
| 57 return config; | 61 return config; |
| 58 } | 62 } |
| 59 | 63 |
| 60 void ExpectEqual(VideoSendStream::Stats one, VideoSendStream::Stats other) { | 64 void ExpectEqual(VideoSendStream::Stats one, VideoSendStream::Stats other) { |
| 61 EXPECT_EQ(one.input_frame_rate, other.input_frame_rate); | 65 EXPECT_EQ(one.input_frame_rate, other.input_frame_rate); |
| 62 EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate); | 66 EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate); |
| 63 EXPECT_EQ(one.media_bitrate_bps, other.media_bitrate_bps); | 67 EXPECT_EQ(one.media_bitrate_bps, other.media_bitrate_bps); |
| 64 EXPECT_EQ(one.suspended, other.suspended); | 68 EXPECT_EQ(one.suspended, other.suspended); |
| 65 | 69 |
| 66 EXPECT_EQ(one.substreams.size(), other.substreams.size()); | 70 EXPECT_EQ(one.substreams.size(), other.substreams.size()); |
| 67 for (std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator it = | 71 for (std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator it = |
| 68 one.substreams.begin(); | 72 one.substreams.begin(); |
| 69 it != one.substreams.end(); ++it) { | 73 it != one.substreams.end(); ++it) { |
| 70 std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator | 74 std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator |
| 71 corresponding_it = other.substreams.find(it->first); | 75 corresponding_it = other.substreams.find(it->first); |
| 72 ASSERT_TRUE(corresponding_it != other.substreams.end()); | 76 ASSERT_TRUE(corresponding_it != other.substreams.end()); |
| 73 const VideoSendStream::StreamStats& a = it->second; | 77 const VideoSendStream::StreamStats& a = it->second; |
| 74 const VideoSendStream::StreamStats& b = corresponding_it->second; | 78 const VideoSendStream::StreamStats& b = corresponding_it->second; |
| 75 | 79 |
| 80 EXPECT_EQ(a.is_rtx, b.is_rtx); |
| 76 EXPECT_EQ(a.frame_counts.key_frames, b.frame_counts.key_frames); | 81 EXPECT_EQ(a.frame_counts.key_frames, b.frame_counts.key_frames); |
| 77 EXPECT_EQ(a.frame_counts.delta_frames, b.frame_counts.delta_frames); | 82 EXPECT_EQ(a.frame_counts.delta_frames, b.frame_counts.delta_frames); |
| 78 EXPECT_EQ(a.total_bitrate_bps, b.total_bitrate_bps); | 83 EXPECT_EQ(a.total_bitrate_bps, b.total_bitrate_bps); |
| 79 EXPECT_EQ(a.avg_delay_ms, b.avg_delay_ms); | 84 EXPECT_EQ(a.avg_delay_ms, b.avg_delay_ms); |
| 80 EXPECT_EQ(a.max_delay_ms, b.max_delay_ms); | 85 EXPECT_EQ(a.max_delay_ms, b.max_delay_ms); |
| 81 | 86 |
| 82 EXPECT_EQ(a.rtp_stats.transmitted.payload_bytes, | 87 EXPECT_EQ(a.rtp_stats.transmitted.payload_bytes, |
| 83 b.rtp_stats.transmitted.payload_bytes); | 88 b.rtp_stats.transmitted.payload_bytes); |
| 84 EXPECT_EQ(a.rtp_stats.transmitted.header_bytes, | 89 EXPECT_EQ(a.rtp_stats.transmitted.header_bytes, |
| 85 b.rtp_stats.transmitted.header_bytes); | 90 b.rtp_stats.transmitted.header_bytes); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 725 |
| 721 EXPECT_EQ( | 726 EXPECT_EQ( |
| 722 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); | 727 1, metrics::NumSamples("WebRTC.Video.Screenshare.FecBitrateSentInKbps")); |
| 723 EXPECT_EQ(1, metrics::NumEvents( | 728 EXPECT_EQ(1, metrics::NumEvents( |
| 724 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", | 729 "WebRTC.Video.Screenshare.FecBitrateSentInKbps", |
| 725 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / | 730 static_cast<int>((rtx_counters.fec.TotalBytes() * 2 * 8) / |
| 726 metrics::kMinRunTimeInSeconds / 1000))); | 731 metrics::kMinRunTimeInSeconds / 1000))); |
| 727 } | 732 } |
| 728 | 733 |
| 729 } // namespace webrtc | 734 } // namespace webrtc |
| OLD | NEW |