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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 stream_bytes = sizeof(encoded_buffer_); | 93 stream_bytes = sizeof(encoded_buffer_); |
94 | 94 |
95 EncodedImage encoded( | 95 EncodedImage encoded( |
96 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); | 96 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); |
97 encoded._timeStamp = input_image.timestamp(); | 97 encoded._timeStamp = input_image.timestamp(); |
98 encoded.capture_time_ms_ = input_image.render_time_ms(); | 98 encoded.capture_time_ms_ = input_image.render_time_ms(); |
99 encoded._frameType = (*frame_types)[i]; | 99 encoded._frameType = (*frame_types)[i]; |
100 encoded._encodedWidth = config_.simulcastStream[i].width; | 100 encoded._encodedWidth = config_.simulcastStream[i].width; |
101 encoded._encodedHeight = config_.simulcastStream[i].height; | 101 encoded._encodedHeight = config_.simulcastStream[i].height; |
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 encoded._length = 0; | 104 continue; |
105 encoded._frameType = kSkipFrame; | |
106 } | |
107 assert(callback_ != NULL); | 105 assert(callback_ != NULL); |
108 if (callback_->Encoded(encoded, &specifics, NULL) != 0) | 106 if (callback_->Encoded(encoded, &specifics, NULL) != 0) |
109 return -1; | 107 return -1; |
110 bits_available -= std::min(encoded._length * 8, bits_available); | 108 bits_available -= std::min(encoded._length * 8, bits_available); |
111 } | 109 } |
112 return 0; | 110 return 0; |
113 } | 111 } |
114 | 112 |
115 int32_t FakeEncoder::RegisterEncodeCompleteCallback( | 113 int32_t FakeEncoder::RegisterEncodeCompleteCallback( |
116 EncodedImageCallback* callback) { | 114 EncodedImageCallback* callback) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 delay_ms_(delay_ms) {} | 188 delay_ms_(delay_ms) {} |
191 | 189 |
192 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 190 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
193 const CodecSpecificInfo* codec_specific_info, | 191 const CodecSpecificInfo* codec_specific_info, |
194 const std::vector<VideoFrameType>* frame_types) { | 192 const std::vector<VideoFrameType>* frame_types) { |
195 SleepMs(delay_ms_); | 193 SleepMs(delay_ms_); |
196 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 194 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
197 } | 195 } |
198 } // namespace test | 196 } // namespace test |
199 } // namespace webrtc | 197 } // namespace webrtc |
OLD | NEW |