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

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

Issue 2710493008: Recreate WebrtcVideoSendStream if screen content setting is changed. (Closed)
Patch Set: readability 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 | « no previous file | webrtc/media/engine/webrtcvideoengine2.h » ('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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (!FindMatchingCodec(codecs_, codec)) 189 if (!FindMatchingCodec(codecs_, codec))
190 return nullptr; 190 return nullptr;
191 FakeWebRtcVideoEncoder* encoder = new FakeWebRtcVideoEncoder(); 191 FakeWebRtcVideoEncoder* encoder = new FakeWebRtcVideoEncoder();
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 while (created_video_encoder_event_.Wait(kEventTimeoutMs)) { 199 int64_t start_offset_ms = rtc::TimeMillis();
200 int64_t wait_time = kEventTimeoutMs;
201 do {
200 if (GetNumCreatedEncoders() >= num_encoders) 202 if (GetNumCreatedEncoders() >= num_encoders)
201 return true; 203 return true;
202 } 204 wait_time = kEventTimeoutMs - (rtc::TimeMillis() - start_offset_ms);
205 } while (wait_time > 0 && created_video_encoder_event_.Wait(wait_time));
203 return false; 206 return false;
204 } 207 }
205 208
206 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override { 209 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override {
207 rtc::CritScope lock(&crit_); 210 rtc::CritScope lock(&crit_);
208 encoders_.erase( 211 encoders_.erase(
209 std::remove(encoders_.begin(), encoders_.end(), encoder), 212 std::remove(encoders_.begin(), encoders_.end(), encoder),
210 encoders_.end()); 213 encoders_.end());
211 delete encoder; 214 delete encoder;
212 } 215 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 rtc::Event created_video_encoder_event_; 254 rtc::Event created_video_encoder_event_;
252 std::vector<cricket::VideoCodec> codecs_; 255 std::vector<cricket::VideoCodec> codecs_;
253 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_); 256 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_);
254 int num_created_encoders_ GUARDED_BY(crit_); 257 int num_created_encoders_ GUARDED_BY(crit_);
255 bool encoders_have_internal_sources_; 258 bool encoders_have_internal_sources_;
256 }; 259 };
257 260
258 } // namespace cricket 261 } // namespace cricket
259 262
260 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_ 263 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698