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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ssrc_stats.rtcp_stats.extended_max_sequence_number = offset + 1; | 122 ssrc_stats.rtcp_stats.extended_max_sequence_number = offset + 1; |
123 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; | 123 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; |
124 ssrc_stats.rtcp_stats.jitter = offset + 3; | 124 ssrc_stats.rtcp_stats.jitter = offset + 3; |
125 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); | 125 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); |
126 } | 126 } |
127 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 127 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
128 ExpectEqual(expected_, stats); | 128 ExpectEqual(expected_, stats); |
129 } | 129 } |
130 | 130 |
131 TEST_F(SendStatisticsProxyTest, EncodedBitrateAndFramerate) { | 131 TEST_F(SendStatisticsProxyTest, EncodedBitrateAndFramerate) { |
132 const int media_bitrate_bps = 500; | 132 int media_bitrate_bps = 500; |
133 const int encode_fps = 29; | 133 int encode_fps = 29; |
134 | 134 |
135 ViEEncoderObserver* encoder_observer = statistics_proxy_.get(); | 135 statistics_proxy_->OnOutgoingRate(encode_fps, media_bitrate_bps); |
136 encoder_observer->OutgoingRate(0, encode_fps, media_bitrate_bps); | |
137 | 136 |
138 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 137 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
139 EXPECT_EQ(media_bitrate_bps, stats.media_bitrate_bps); | 138 EXPECT_EQ(media_bitrate_bps, stats.media_bitrate_bps); |
140 EXPECT_EQ(encode_fps, stats.encode_frame_rate); | 139 EXPECT_EQ(encode_fps, stats.encode_frame_rate); |
141 } | 140 } |
142 | 141 |
143 TEST_F(SendStatisticsProxyTest, Suspended) { | 142 TEST_F(SendStatisticsProxyTest, Suspended) { |
144 // Verify that the value is false by default. | 143 // Verify that the value is false by default. |
145 EXPECT_FALSE(statistics_proxy_->GetStats().suspended); | 144 EXPECT_FALSE(statistics_proxy_->GetStats().suspended); |
146 | 145 |
147 // Verify that we can set it to true. | 146 // Verify that we can set it to true. |
148 ViEEncoderObserver* encoder_observer = statistics_proxy_.get(); | 147 statistics_proxy_->OnSuspendChange(true); |
149 encoder_observer->SuspendChange(0, true); | |
150 EXPECT_TRUE(statistics_proxy_->GetStats().suspended); | 148 EXPECT_TRUE(statistics_proxy_->GetStats().suspended); |
151 | 149 |
152 // Verify that we can set it back to false again. | 150 // Verify that we can set it back to false again. |
153 encoder_observer->SuspendChange(0, false); | 151 statistics_proxy_->OnSuspendChange(false); |
154 EXPECT_FALSE(statistics_proxy_->GetStats().suspended); | 152 EXPECT_FALSE(statistics_proxy_->GetStats().suspended); |
155 } | 153 } |
156 | 154 |
157 TEST_F(SendStatisticsProxyTest, FrameCounts) { | 155 TEST_F(SendStatisticsProxyTest, FrameCounts) { |
158 FrameCountObserver* observer = statistics_proxy_.get(); | 156 FrameCountObserver* observer = statistics_proxy_.get(); |
159 for (std::vector<uint32_t>::const_iterator it = config_.rtp.ssrcs.begin(); | 157 for (std::vector<uint32_t>::const_iterator it = config_.rtp.ssrcs.begin(); |
160 it != config_.rtp.ssrcs.end(); | 158 it != config_.rtp.ssrcs.end(); |
161 ++it) { | 159 ++it) { |
162 const uint32_t ssrc = *it; | 160 const uint32_t ssrc = *it; |
163 // Add statistics with some arbitrary, but unique, numbers. | 161 // Add statistics with some arbitrary, but unique, numbers. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 396 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
399 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), | 397 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), |
400 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps); | 398 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps); |
401 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), | 399 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), |
402 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps); | 400 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps); |
403 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps); | 401 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps); |
404 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps); | 402 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps); |
405 } | 403 } |
406 | 404 |
407 } // namespace webrtc | 405 } // namespace webrtc |
OLD | NEW |