OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (!H264CMSampleBufferToAnnexBBuffer(sample_buffer, | 191 if (!H264CMSampleBufferToAnnexBBuffer(sample_buffer, |
192 is_keyframe, | 192 is_keyframe, |
193 buffer.get(), | 193 buffer.get(), |
194 header.accept())) { | 194 header.accept())) { |
195 return; | 195 return; |
196 } | 196 } |
197 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size()); | 197 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size()); |
198 frame._encodedWidth = encode_params->width; | 198 frame._encodedWidth = encode_params->width; |
199 frame._encodedHeight = encode_params->height; | 199 frame._encodedHeight = encode_params->height; |
200 frame._completeFrame = true; | 200 frame._completeFrame = true; |
201 frame._frameType = is_keyframe ? webrtc::kKeyFrame : webrtc::kDeltaFrame; | 201 frame._frameType = |
| 202 is_keyframe ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta; |
202 frame.capture_time_ms_ = encode_params->render_time_ms; | 203 frame.capture_time_ms_ = encode_params->render_time_ms; |
203 frame._timeStamp = encode_params->timestamp; | 204 frame._timeStamp = encode_params->timestamp; |
204 | 205 |
205 int result = encode_params->callback->Encoded( | 206 int result = encode_params->callback->Encoded( |
206 frame, &(encode_params->codec_specific_info), header.get()); | 207 frame, &(encode_params->codec_specific_info), header.get()); |
207 if (result != 0) { | 208 if (result != 0) { |
208 LOG(LS_ERROR) << "Encoded callback failed: " << result; | 209 LOG(LS_ERROR) << "Encoded callback failed: " << result; |
209 } | 210 } |
210 } | 211 } |
211 | 212 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (!internal::CopyVideoFrameToPixelBuffer(input_image, pixel_buffer)) { | 271 if (!internal::CopyVideoFrameToPixelBuffer(input_image, pixel_buffer)) { |
271 LOG(LS_ERROR) << "Failed to copy frame data."; | 272 LOG(LS_ERROR) << "Failed to copy frame data."; |
272 CVBufferRelease(pixel_buffer); | 273 CVBufferRelease(pixel_buffer); |
273 return WEBRTC_VIDEO_CODEC_ERROR; | 274 return WEBRTC_VIDEO_CODEC_ERROR; |
274 } | 275 } |
275 | 276 |
276 // Check if we need a keyframe. | 277 // Check if we need a keyframe. |
277 bool is_keyframe_required = false; | 278 bool is_keyframe_required = false; |
278 if (frame_types) { | 279 if (frame_types) { |
279 for (auto frame_type : *frame_types) { | 280 for (auto frame_type : *frame_types) { |
280 if (frame_type == kKeyFrame) { | 281 if (frame_type == kVideoFrameKey) { |
281 is_keyframe_required = true; | 282 is_keyframe_required = true; |
282 break; | 283 break; |
283 } | 284 } |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
287 CMTime presentation_time_stamp = | 288 CMTime presentation_time_stamp = |
288 CMTimeMake(input_image.render_time_ms(), 1000); | 289 CMTimeMake(input_image.render_time_ms(), 1000); |
289 CFDictionaryRef frame_properties = nullptr; | 290 CFDictionaryRef frame_properties = nullptr; |
290 if (is_keyframe_required) { | 291 if (is_keyframe_required) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (compression_session_) { | 430 if (compression_session_) { |
430 VTCompressionSessionInvalidate(compression_session_); | 431 VTCompressionSessionInvalidate(compression_session_); |
431 CFRelease(compression_session_); | 432 CFRelease(compression_session_); |
432 compression_session_ = nullptr; | 433 compression_session_ = nullptr; |
433 } | 434 } |
434 } | 435 } |
435 | 436 |
436 } // namespace webrtc | 437 } // namespace webrtc |
437 | 438 |
438 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 439 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |