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 // TODO(holmer): The FakeEncoder should store the bits_available between | 93 // TODO(holmer): The FakeEncoder should store the bits_available between |
94 // encodes so that it can compensate for oversized frames. | 94 // encodes so that it can compensate for oversized frames. |
95 stream_bytes *= 10; | 95 stream_bytes *= 10; |
96 } | 96 } |
97 if (stream_bytes > sizeof(encoded_buffer_)) | 97 if (stream_bytes > sizeof(encoded_buffer_)) |
98 stream_bytes = sizeof(encoded_buffer_); | 98 stream_bytes = sizeof(encoded_buffer_); |
99 | 99 |
100 EncodedImage encoded( | 100 EncodedImage encoded( |
101 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); | 101 encoded_buffer_, stream_bytes, sizeof(encoded_buffer_)); |
102 encoded._timeStamp = input_image.timestamp(); | 102 encoded._timeStamp = input_image.timestamp(); |
103 encoded.ntp_time_ms_ = input_image.ntp_time_ms(); | |
tommi
2016/07/06 11:15:01
was this missing before? Would it make sense to m
perkj_webrtc
2016/07/06 13:08:53
EncodedImage is a horrible struct that is used in
| |
103 encoded.capture_time_ms_ = input_image.render_time_ms(); | 104 encoded.capture_time_ms_ = input_image.render_time_ms(); |
104 encoded._frameType = (*frame_types)[i]; | 105 encoded._frameType = (*frame_types)[i]; |
105 encoded._encodedWidth = config_.simulcastStream[i].width; | 106 encoded._encodedWidth = config_.simulcastStream[i].width; |
106 encoded._encodedHeight = config_.simulcastStream[i].height; | 107 encoded._encodedHeight = config_.simulcastStream[i].height; |
107 // Always encode something on the first frame. | 108 // Always encode something on the first frame. |
108 if (min_stream_bits > bits_available && i > 0) | 109 if (min_stream_bits > bits_available && i > 0) |
tommi
2016/07/06 11:15:02
seems like this check should be done before we ini
perkj_webrtc
2016/07/06 13:08:54
ok, should not matter much since its only pointer
| |
109 continue; | 110 continue; |
110 assert(callback_ != NULL); | 111 assert(callback_ != NULL); |
tommi
2016/07/06 11:15:01
can you change all assert()s to RTC_DCHECK in this
perkj_webrtc
2016/07/06 13:08:53
Done.
| |
111 if (callback_->Encoded(encoded, &specifics, NULL) != 0) | 112 if (callback_->Encoded(encoded, &specifics, NULL) != 0) |
112 return -1; | 113 return -1; |
113 bits_available -= std::min(encoded._length * 8, bits_available); | 114 bits_available -= std::min(encoded._length * 8, bits_available); |
114 } | 115 } |
115 return 0; | 116 return 0; |
116 } | 117 } |
117 | 118 |
118 int32_t FakeEncoder::RegisterEncodeCompleteCallback( | 119 int32_t FakeEncoder::RegisterEncodeCompleteCallback( |
119 EncodedImageCallback* callback) { | 120 EncodedImageCallback* callback) { |
120 callback_ = callback; | 121 callback_ = callback; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 delay_ms_(delay_ms) {} | 199 delay_ms_(delay_ms) {} |
199 | 200 |
200 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, | 201 int32_t DelayedEncoder::Encode(const VideoFrame& input_image, |
201 const CodecSpecificInfo* codec_specific_info, | 202 const CodecSpecificInfo* codec_specific_info, |
202 const std::vector<FrameType>* frame_types) { | 203 const std::vector<FrameType>* frame_types) { |
203 SleepMs(delay_ms_); | 204 SleepMs(delay_ms_); |
204 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); | 205 return FakeEncoder::Encode(input_image, codec_specific_info, frame_types); |
205 } | 206 } |
206 } // namespace test | 207 } // namespace test |
207 } // namespace webrtc | 208 } // namespace webrtc |
OLD | NEW |