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 29 matching lines...) Expand all Loading... |
40 int32_t FakeEncoder::InitEncode(const VideoCodec* config, | 40 int32_t FakeEncoder::InitEncode(const VideoCodec* config, |
41 int32_t number_of_cores, | 41 int32_t number_of_cores, |
42 size_t max_payload_size) { | 42 size_t max_payload_size) { |
43 config_ = *config; | 43 config_ = *config; |
44 target_bitrate_kbps_ = config_.startBitrate; | 44 target_bitrate_kbps_ = config_.startBitrate; |
45 return 0; | 45 return 0; |
46 } | 46 } |
47 | 47 |
48 int32_t FakeEncoder::Encode(const VideoFrame& input_image, | 48 int32_t FakeEncoder::Encode(const VideoFrame& input_image, |
49 const CodecSpecificInfo* codec_specific_info, | 49 const CodecSpecificInfo* codec_specific_info, |
50 const std::vector<VideoFrameType>* frame_types) { | 50 const std::vector<FrameType>* frame_types) { |
51 assert(config_.maxFramerate > 0); | 51 assert(config_.maxFramerate > 0); |
52 int64_t time_since_last_encode_ms = 1000 / config_.maxFramerate; | 52 int64_t time_since_last_encode_ms = 1000 / config_.maxFramerate; |
53 int64_t time_now_ms = clock_->TimeInMilliseconds(); | 53 int64_t time_now_ms = clock_->TimeInMilliseconds(); |
54 const bool first_encode = last_encode_time_ms_ == 0; | 54 const bool first_encode = last_encode_time_ms_ == 0; |
55 if (!first_encode) { | 55 if (!first_encode) { |
56 // For all frames but the first we can estimate the display time by looking | 56 // For all frames but the first we can estimate the display time by looking |
57 // at the display time of the previous frame. | 57 // at the display time of the previous frame. |
58 time_since_last_encode_ms = time_now_ms - last_encode_time_ms_; | 58 time_since_last_encode_ms = time_now_ms - last_encode_time_ms_; |
59 } | 59 } |
60 | 60 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 return callback_->Encoded(encoded_image, NULL, &fragmentation); | 183 return callback_->Encoded(encoded_image, NULL, &fragmentation); |
184 } | 184 } |
185 | 185 |
186 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) | 186 DelayedEncoder::DelayedEncoder(Clock* clock, int delay_ms) |
187 : test::FakeEncoder(clock), | 187 : test::FakeEncoder(clock), |
188 delay_ms_(delay_ms) {} | 188 delay_ms_(delay_ms) {} |
189 | 189 |
190 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 190 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
191 const CodecSpecificInfo* codec_specific_info, | 191 const CodecSpecificInfo* codec_specific_info, |
192 const std::vector<VideoFrameType>* frame_types) { | 192 const std::vector<FrameType>* frame_types) { |
193 SleepMs(delay_ms_); | 193 SleepMs(delay_ms_); |
194 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 194 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
195 } | 195 } |
196 } // namespace test | 196 } // namespace test |
197 } // namespace webrtc | 197 } // namespace webrtc |
OLD | NEW |