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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 CodecSpecificInfo specifics; | 197 CodecSpecificInfo specifics; |
198 memset(&specifics, 0, sizeof(specifics)); | 198 memset(&specifics, 0, sizeof(specifics)); |
199 specifics.codecType = kVideoCodecH264; | 199 specifics.codecType = kVideoCodecH264; |
200 return callback_->OnEncodedImage(encoded_image, &specifics, &fragmentation); | 200 return callback_->OnEncodedImage(encoded_image, &specifics, &fragmentation); |
201 } | 201 } |
202 | 202 |
203 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) | 203 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) |
204 : test::FakeEncoder(clock), | 204 : test::FakeEncoder(clock), |
205 delay_ms_(delay_ms) {} | 205 delay_ms_(delay_ms) {} |
206 | 206 |
| 207 void DelayedEncoder::SetDelay(int delay_ms) { |
| 208 rtc::CritScope lock(&lock_); |
| 209 delay_ms_ = delay_ms; |
| 210 } |
| 211 |
207 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 212 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
208 const CodecSpecificInfo* codec_specific_info, | 213 const CodecSpecificInfo* codec_specific_info, |
209 const std::vector<FrameType>* frame_types) { | 214 const std::vector<FrameType>* frame_types) { |
210 SleepMs(delay_ms_); | 215 int delay_ms = 0; |
| 216 { |
| 217 rtc::CritScope lock(&lock_); |
| 218 delay_ms = delay_ms_; |
| 219 } |
| 220 SleepMs(delay_ms); |
211 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 221 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
212 } | 222 } |
213 } // namespace test | 223 } // namespace test |
214 } // namespace webrtc | 224 } // namespace webrtc |
OLD | NEW |