Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Side by Side Diff: webrtc/media/engine/fakewebrtcvideoengine.h

Issue 2721333003: Fix race in WebRtcVideoEngine2Tests, improve coverage. (Closed)
Patch Set: s/EXPECT_EQ(false, /EXPECT_FALSE( Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.cc ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 encoders_.push_back(encoder); 192 encoders_.push_back(encoder);
193 num_created_encoders_++; 193 num_created_encoders_++;
194 created_video_encoder_event_.Set(); 194 created_video_encoder_event_.Set();
195 return encoder; 195 return encoder;
196 } 196 }
197 197
198 bool WaitForCreatedVideoEncoders(int num_encoders) { 198 bool WaitForCreatedVideoEncoders(int num_encoders) {
199 int64_t start_offset_ms = rtc::TimeMillis(); 199 int64_t start_offset_ms = rtc::TimeMillis();
200 int64_t wait_time = kEventTimeoutMs; 200 int64_t wait_time = kEventTimeoutMs;
201 do { 201 do {
202 if (GetNumCreatedEncoders() >= num_encoders) 202 int num_created_encoders = GetNumCreatedEncoders();
203 if (num_created_encoders == num_encoders) {
203 return true; 204 return true;
205 } else if (num_created_encoders > num_encoders) {
206 return false;
207 }
204 wait_time = kEventTimeoutMs - (rtc::TimeMillis() - start_offset_ms); 208 wait_time = kEventTimeoutMs - (rtc::TimeMillis() - start_offset_ms);
205 } while (wait_time > 0 && created_video_encoder_event_.Wait(wait_time)); 209 } while (wait_time > 0 && created_video_encoder_event_.Wait(wait_time));
206 return false; 210 return false;
207 } 211 }
208 212
209 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override { 213 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override {
210 rtc::CritScope lock(&crit_); 214 rtc::CritScope lock(&crit_);
211 encoders_.erase( 215 encoders_.erase(
212 std::remove(encoders_.begin(), encoders_.end(), encoder), 216 std::remove(encoders_.begin(), encoders_.end(), encoder),
213 encoders_.end()); 217 encoders_.end());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 rtc::Event created_video_encoder_event_; 258 rtc::Event created_video_encoder_event_;
255 std::vector<cricket::VideoCodec> codecs_; 259 std::vector<cricket::VideoCodec> codecs_;
256 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_); 260 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_);
257 int num_created_encoders_ GUARDED_BY(crit_); 261 int num_created_encoders_ GUARDED_BY(crit_);
258 bool encoders_have_internal_sources_; 262 bool encoders_have_internal_sources_;
259 }; 263 };
260 264
261 } // namespace cricket 265 } // namespace cricket
262 266
263 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_ 267 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.cc ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698