Chromium Code Reviews| 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2118 : EndToEndTest(kLongTimeoutMs), | 2118 : EndToEndTest(kLongTimeoutMs), |
| 2119 use_rtx_(use_rtx), | 2119 use_rtx_(use_rtx), |
| 2120 use_red_(use_red), | 2120 use_red_(use_red), |
| 2121 screenshare_(screenshare), | 2121 screenshare_(screenshare), |
| 2122 // This test uses NACK, so to send FEC we can't use a fake encoder. | 2122 // This test uses NACK, so to send FEC we can't use a fake encoder. |
| 2123 vp8_encoder_( | 2123 vp8_encoder_( |
| 2124 use_red ? VideoEncoder::Create(VideoEncoder::EncoderType::kVp8) | 2124 use_red ? VideoEncoder::Create(VideoEncoder::EncoderType::kVp8) |
| 2125 : nullptr), | 2125 : nullptr), |
| 2126 sender_call_(nullptr), | 2126 sender_call_(nullptr), |
| 2127 receiver_call_(nullptr), | 2127 receiver_call_(nullptr), |
| 2128 start_runtime_ms_(-1) {} | 2128 start_runtime_ms_(-1), |
| 2129 num_frames_received_(0) {} | |
| 2129 | 2130 |
| 2130 private: | 2131 private: |
| 2131 void OnFrame(const VideoFrame& video_frame) override {} | 2132 void OnFrame(const VideoFrame& video_frame) override { |
| 2133 rtc::CritScope lock(&crit_); | |
| 2134 ++num_frames_received_; | |
| 2135 } | |
| 2132 | 2136 |
| 2133 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 2137 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 2134 if (MinMetricRunTimePassed()) | 2138 if (MinMetricRunTimePassed() && MinNumberOfFramesReceived()) |
| 2135 observation_complete_.Set(); | 2139 observation_complete_.Set(); |
| 2136 | 2140 |
| 2137 return SEND_PACKET; | 2141 return SEND_PACKET; |
| 2138 } | 2142 } |
| 2139 | 2143 |
| 2140 bool MinMetricRunTimePassed() { | 2144 bool MinMetricRunTimePassed() { |
| 2141 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); | 2145 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); |
| 2142 if (start_runtime_ms_ == -1) { | 2146 if (start_runtime_ms_ == -1) { |
| 2143 start_runtime_ms_ = now; | 2147 start_runtime_ms_ = now; |
| 2144 return false; | 2148 return false; |
| 2145 } | 2149 } |
| 2146 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000; | 2150 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000; |
| 2147 return elapsed_sec > metrics::kMinRunTimeInSeconds * 2; | 2151 return elapsed_sec > metrics::kMinRunTimeInSeconds * 2; |
| 2148 } | 2152 } |
| 2149 | 2153 |
| 2154 bool MinNumberOfFramesReceived() const { | |
| 2155 const int kMinRequiredHistogramSamples = 200; | |
| 2156 rtc::CritScope lock(&crit_); | |
| 2157 return num_frames_received_ > kMinRequiredHistogramSamples * 2; | |
|
sprang_webrtc
2016/10/17 07:50:18
Why the *2 ?
åsapersson
2016/10/17 18:03:41
Updated the cl and added a comment, ptal.
| |
| 2158 } | |
| 2159 | |
| 2150 void ModifyVideoConfigs( | 2160 void ModifyVideoConfigs( |
| 2151 VideoSendStream::Config* send_config, | 2161 VideoSendStream::Config* send_config, |
| 2152 std::vector<VideoReceiveStream::Config>* receive_configs, | 2162 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 2153 VideoEncoderConfig* encoder_config) override { | 2163 VideoEncoderConfig* encoder_config) override { |
| 2154 static const int kExtensionId = 8; | 2164 static const int kExtensionId = 8; |
| 2155 send_config->rtp.extensions.push_back(RtpExtension( | 2165 send_config->rtp.extensions.push_back(RtpExtension( |
| 2156 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 2166 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
| 2157 (*receive_configs)[0].rtp.extensions.push_back(RtpExtension( | 2167 (*receive_configs)[0].rtp.extensions.push_back(RtpExtension( |
| 2158 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 2168 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
| 2159 // NACK | 2169 // NACK |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2189 | 2199 |
| 2190 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { | 2200 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
| 2191 sender_call_ = sender_call; | 2201 sender_call_ = sender_call; |
| 2192 receiver_call_ = receiver_call; | 2202 receiver_call_ = receiver_call; |
| 2193 } | 2203 } |
| 2194 | 2204 |
| 2195 void PerformTest() override { | 2205 void PerformTest() override { |
| 2196 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; | 2206 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; |
| 2197 } | 2207 } |
| 2198 | 2208 |
| 2209 rtc::CriticalSection crit_; | |
| 2199 const bool use_rtx_; | 2210 const bool use_rtx_; |
| 2200 const bool use_red_; | 2211 const bool use_red_; |
| 2201 const bool screenshare_; | 2212 const bool screenshare_; |
| 2202 const std::unique_ptr<VideoEncoder> vp8_encoder_; | 2213 const std::unique_ptr<VideoEncoder> vp8_encoder_; |
| 2203 Call* sender_call_; | 2214 Call* sender_call_; |
| 2204 Call* receiver_call_; | 2215 Call* receiver_call_; |
| 2205 int64_t start_runtime_ms_; | 2216 int64_t start_runtime_ms_; |
| 2217 int num_frames_received_ GUARDED_BY(&crit_); | |
| 2206 } test(use_rtx, use_red, screenshare); | 2218 } test(use_rtx, use_red, screenshare); |
| 2207 | 2219 |
| 2208 metrics::Reset(); | 2220 metrics::Reset(); |
| 2209 RunBaseTest(&test); | 2221 RunBaseTest(&test); |
| 2210 | 2222 |
| 2211 // Delete the call for Call stats to be reported. | 2223 // Delete the call for Call stats to be reported. |
| 2212 sender_call_.reset(); | 2224 sender_call_.reset(); |
| 2213 receiver_call_.reset(); | 2225 receiver_call_.reset(); |
| 2214 | 2226 |
| 2215 std::string video_prefix = | 2227 std::string video_prefix = |
| (...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3923 std::unique_ptr<VideoEncoder> encoder_; | 3935 std::unique_ptr<VideoEncoder> encoder_; |
| 3924 std::unique_ptr<VideoDecoder> decoder_; | 3936 std::unique_ptr<VideoDecoder> decoder_; |
| 3925 rtc::CriticalSection crit_; | 3937 rtc::CriticalSection crit_; |
| 3926 int recorded_frames_ GUARDED_BY(crit_); | 3938 int recorded_frames_ GUARDED_BY(crit_); |
| 3927 } test(this); | 3939 } test(this); |
| 3928 | 3940 |
| 3929 RunBaseTest(&test); | 3941 RunBaseTest(&test); |
| 3930 } | 3942 } |
| 3931 | 3943 |
| 3932 } // namespace webrtc | 3944 } // namespace webrtc |
| OLD | NEW |