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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Always encode something on the first frame. | 102 // Always encode something on the first frame. |
103 if (min_stream_bits > bits_available && i > 0) | 103 if (min_stream_bits > bits_available && i > 0) |
104 continue; | 104 continue; |
105 EncodedImage encoded( | 105 EncodedImage encoded( |
106 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); | 106 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); |
107 encoded._timeStamp = input_image.timestamp(); | 107 encoded._timeStamp = input_image.timestamp(); |
108 encoded.capture_time_ms_ = input_image.render_time_ms(); | 108 encoded.capture_time_ms_ = input_image.render_time_ms(); |
109 encoded._frameType = (*frame_types)[i]; | 109 encoded._frameType = (*frame_types)[i]; |
110 encoded._encodedWidth = config_.simulcastStream[i].width; | 110 encoded._encodedWidth = config_.simulcastStream[i].width; |
111 encoded._encodedHeight = config_.simulcastStream[i].height; | 111 encoded._encodedHeight = config_.simulcastStream[i].height; |
| 112 encoded.rotation_ = input_image.rotation(); |
112 RTC_DCHECK(callback_ != NULL); | 113 RTC_DCHECK(callback_ != NULL); |
113 specifics.codec_name = ImplementationName(); | 114 specifics.codec_name = ImplementationName(); |
114 if (callback_->Encoded(encoded, &specifics, NULL) != 0) | 115 if (callback_->Encoded(encoded, &specifics, NULL) != 0) |
115 return -1; | 116 return -1; |
116 bits_available -= std::min(encoded._length * 8, bits_available); | 117 bits_available -= std::min(encoded._length * 8, bits_available); |
117 } | 118 } |
118 return 0; | 119 return 0; |
119 } | 120 } |
120 | 121 |
121 int32_t FakeEncoder::RegisterEncodeCompleteCallback( | 122 int32_t FakeEncoder::RegisterEncodeCompleteCallback( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 CodecSpecificInfo specifics; | 198 CodecSpecificInfo specifics; |
198 memset(&specifics, 0, sizeof(specifics)); | 199 memset(&specifics, 0, sizeof(specifics)); |
199 specifics.codecType = kVideoCodecH264; | 200 specifics.codecType = kVideoCodecH264; |
200 return callback_->OnEncodedImage(encoded_image, &specifics, &fragmentation); | 201 return callback_->OnEncodedImage(encoded_image, &specifics, &fragmentation); |
201 } | 202 } |
202 | 203 |
203 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) | 204 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) |
204 : test::FakeEncoder(clock), | 205 : test::FakeEncoder(clock), |
205 delay_ms_(delay_ms) {} | 206 delay_ms_(delay_ms) {} |
206 | 207 |
| 208 void DelayedEncoder::SetDelay(int delay_ms) { |
| 209 rtc::CritScope lock(&lock_); |
| 210 delay_ms_ = delay_ms; |
| 211 } |
| 212 |
207 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 213 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
208 const CodecSpecificInfo* codec_specific_info, | 214 const CodecSpecificInfo* codec_specific_info, |
209 const std::vector<FrameType>* frame_types) { | 215 const std::vector<FrameType>* frame_types) { |
210 SleepMs(delay_ms_); | 216 int delay_ms = 0; |
| 217 { |
| 218 rtc::CritScope lock(&lock_); |
| 219 delay_ms = delay_ms_; |
| 220 } |
| 221 SleepMs(delay_ms); |
211 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 222 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
212 } | 223 } |
213 } // namespace test | 224 } // namespace test |
214 } // namespace webrtc | 225 } // namespace webrtc |
OLD | NEW |