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 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2138 rtp_rtcp_->SetSSRC((*receive_configs)[0].rtp.local_ssrc); | 2138 rtp_rtcp_->SetSSRC((*receive_configs)[0].rtp.local_ssrc); |
| 2139 rtp_rtcp_->SetREMBStatus(true); | 2139 rtp_rtcp_->SetREMBStatus(true); |
| 2140 rtp_rtcp_->SetSendingStatus(true); | 2140 rtp_rtcp_->SetSendingStatus(true); |
| 2141 rtp_rtcp_->SetRTCPStatus(RtcpMode::kReducedSize); | 2141 rtp_rtcp_->SetRTCPStatus(RtcpMode::kReducedSize); |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { | 2144 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
| 2145 sender_call_ = sender_call; | 2145 sender_call_ = sender_call; |
| 2146 } | 2146 } |
| 2147 | 2147 |
| 2148 static bool BitrateStatsPollingThread(void* obj) { | 2148 static void BitrateStatsPollingThread(void* obj) { |
| 2149 return static_cast<BweObserver*>(obj)->PollStats(); | 2149 static_cast<BweObserver*>(obj)->PollStats(); |
| 2150 } | 2150 } |
| 2151 | 2151 |
| 2152 bool PollStats() { | 2152 void PollStats() { |
| 2153 if (sender_call_) { | 2153 do { |
| 2154 Call::Stats stats = sender_call_->GetStats(); | 2154 if (sender_call_) { |
| 2155 switch (state_) { | 2155 Call::Stats stats = sender_call_->GetStats(); |
| 2156 case kWaitForFirstRampUp: | 2156 switch (state_) { |
| 2157 if (stats.send_bandwidth_bps >= remb_bitrate_bps_) { | 2157 case kWaitForFirstRampUp: |
| 2158 state_ = kWaitForRemb; | 2158 if (stats.send_bandwidth_bps >= remb_bitrate_bps_) { |
| 2159 remb_bitrate_bps_ /= 2; | 2159 state_ = kWaitForRemb; |
| 2160 rtp_rtcp_->SetREMBData( | 2160 remb_bitrate_bps_ /= 2; |
| 2161 remb_bitrate_bps_, | 2161 rtp_rtcp_->SetREMBData( |
| 2162 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1)); | 2162 remb_bitrate_bps_, |
| 2163 rtp_rtcp_->SendRTCP(kRtcpRr); | 2163 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1)); |
| 2164 } | 2164 rtp_rtcp_->SendRTCP(kRtcpRr); |
| 2165 break; | 2165 } |
| 2166 break; | |
| 2166 | 2167 |
| 2167 case kWaitForRemb: | 2168 case kWaitForRemb: |
| 2168 if (stats.send_bandwidth_bps == remb_bitrate_bps_) { | 2169 if (stats.send_bandwidth_bps == remb_bitrate_bps_) { |
| 2169 state_ = kWaitForSecondRampUp; | 2170 state_ = kWaitForSecondRampUp; |
| 2170 remb_bitrate_bps_ *= 2; | 2171 remb_bitrate_bps_ *= 2; |
| 2171 rtp_rtcp_->SetREMBData( | 2172 rtp_rtcp_->SetREMBData( |
| 2172 remb_bitrate_bps_, | 2173 remb_bitrate_bps_, |
| 2173 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1)); | 2174 std::vector<uint32_t>(&sender_ssrc_, &sender_ssrc_ + 1)); |
| 2174 rtp_rtcp_->SendRTCP(kRtcpRr); | 2175 rtp_rtcp_->SendRTCP(kRtcpRr); |
| 2175 } | 2176 } |
| 2176 break; | 2177 break; |
| 2177 | 2178 |
| 2178 case kWaitForSecondRampUp: | 2179 case kWaitForSecondRampUp: |
| 2179 if (stats.send_bandwidth_bps == remb_bitrate_bps_) { | 2180 if (stats.send_bandwidth_bps == remb_bitrate_bps_) { |
| 2180 observation_complete_.Set(); | 2181 observation_complete_.Set(); |
| 2181 } | 2182 } |
| 2182 break; | 2183 break; |
| 2184 } | |
| 2183 } | 2185 } |
| 2184 } | 2186 } while (!stop_event_.Wait(1000)); |
|
the sun
2017/02/22 13:42:58
note: this appears to work since stop_event_.Set()
tommi
2017/02/22 15:04:01
Yes, that's the case I found and fixed yesterday.
| |
| 2185 | |
| 2186 return !stop_event_.Wait(1000); | |
| 2187 } | 2187 } |
| 2188 | 2188 |
| 2189 void PerformTest() override { | 2189 void PerformTest() override { |
| 2190 poller_thread_.Start(); | 2190 poller_thread_.Start(); |
| 2191 EXPECT_TRUE(Wait()) | 2191 EXPECT_TRUE(Wait()) |
| 2192 << "Timed out while waiting for bitrate to change according to REMB."; | 2192 << "Timed out while waiting for bitrate to change according to REMB."; |
| 2193 stop_event_.Set(); | 2193 stop_event_.Set(); |
| 2194 poller_thread_.Stop(); | 2194 poller_thread_.Stop(); |
| 2195 } | 2195 } |
| 2196 | 2196 |
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4190 std::unique_ptr<VideoEncoder> encoder_; | 4190 std::unique_ptr<VideoEncoder> encoder_; |
| 4191 std::unique_ptr<VideoDecoder> decoder_; | 4191 std::unique_ptr<VideoDecoder> decoder_; |
| 4192 rtc::CriticalSection crit_; | 4192 rtc::CriticalSection crit_; |
| 4193 int recorded_frames_ GUARDED_BY(crit_); | 4193 int recorded_frames_ GUARDED_BY(crit_); |
| 4194 } test(this); | 4194 } test(this); |
| 4195 | 4195 |
| 4196 RunBaseTest(&test); | 4196 RunBaseTest(&test); |
| 4197 } | 4197 } |
| 4198 | 4198 |
| 4199 } // namespace webrtc | 4199 } // namespace webrtc |
| OLD | NEW |