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) { |
stefan-webrtc
2015/10/02 13:43:08
Optionally remove {}
| |
104 encoded._length = 0; | 104 continue; |
105 encoded._frameType = kSkipFrame; | |
106 } | 105 } |
107 assert(callback_ != NULL); | 106 assert(callback_ != NULL); |
108 if (callback_->Encoded(encoded, &specifics, NULL) != 0) | 107 if (callback_->Encoded(encoded, &specifics, NULL) != 0) |
109 return -1; | 108 return -1; |
110 bits_available -= std::min(encoded._length * 8, bits_available); | 109 bits_available -= std::min(encoded._length * 8, bits_available); |
111 } | 110 } |
112 return 0; | 111 return 0; |
113 } | 112 } |
114 | 113 |
115 int32_t FakeEncoder::RegisterEncodeCompleteCallback( | 114 int32_t FakeEncoder::RegisterEncodeCompleteCallback( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 delay_ms_(delay_ms) {} | 189 delay_ms_(delay_ms) {} |
191 | 190 |
192 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 191 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
193 const CodecSpecificInfo* codec_specific_info, | 192 const CodecSpecificInfo* codec_specific_info, |
194 const std::vector<VideoFrameType>* frame_types) { | 193 const std::vector<VideoFrameType>* frame_types) { |
195 SleepMs(delay_ms_); | 194 SleepMs(delay_ms_); |
196 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 195 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
197 } | 196 } |
198 } // namespace test | 197 } // namespace test |
199 } // namespace webrtc | 198 } // namespace webrtc |
OLD | NEW |