Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.mm

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Fix typo, leading to failed video catpure test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 int H264VideoToolboxEncoder::InitEncode(const VideoCodec* codec_settings, 359 int H264VideoToolboxEncoder::InitEncode(const VideoCodec* codec_settings,
360 int number_of_cores, 360 int number_of_cores,
361 size_t max_payload_size) { 361 size_t max_payload_size) {
362 RTC_DCHECK(codec_settings); 362 RTC_DCHECK(codec_settings);
363 RTC_DCHECK_EQ(codec_settings->codecType, kVideoCodecH264); 363 RTC_DCHECK_EQ(codec_settings->codecType, kVideoCodecH264);
364 364
365 width_ = codec_settings->width; 365 width_ = codec_settings->width;
366 height_ = codec_settings->height; 366 height_ = codec_settings->height;
367 mode_ = codec_settings->mode;
367 // We can only set average bitrate on the HW encoder. 368 // We can only set average bitrate on the HW encoder.
368 target_bitrate_bps_ = codec_settings->startBitrate; 369 target_bitrate_bps_ = codec_settings->startBitrate;
369 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_); 370 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_);
370 371
371 // TODO(tkchin): Try setting payload size via 372 // TODO(tkchin): Try setting payload size via
372 // kVTCompressionPropertyKey_MaxH264SliceBytes. 373 // kVTCompressionPropertyKey_MaxH264SliceBytes.
373 374
374 return ResetCompressionSession(); 375 return ResetCompressionSession();
375 } 376 }
376 377
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size()); 716 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size());
716 frame._encodedWidth = width; 717 frame._encodedWidth = width;
717 frame._encodedHeight = height; 718 frame._encodedHeight = height;
718 frame._completeFrame = true; 719 frame._completeFrame = true;
719 frame._frameType = 720 frame._frameType =
720 is_keyframe ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta; 721 is_keyframe ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta;
721 frame.capture_time_ms_ = render_time_ms; 722 frame.capture_time_ms_ = render_time_ms;
722 frame._timeStamp = timestamp; 723 frame._timeStamp = timestamp;
723 frame.rotation_ = rotation; 724 frame.rotation_ = rotation;
724 725
726 frame.content_type_ =
727 (mode_ == kScreensharing) ? VideoContentType::SCREENSHARE : VideoContentTy pe::UNSPECIFIED;
728
725 h264_bitstream_parser_.ParseBitstream(buffer->data(), buffer->size()); 729 h264_bitstream_parser_.ParseBitstream(buffer->data(), buffer->size());
726 h264_bitstream_parser_.GetLastSliceQp(&frame.qp_); 730 h264_bitstream_parser_.GetLastSliceQp(&frame.qp_);
727 731
728 EncodedImageCallback::Result res = 732 EncodedImageCallback::Result res =
729 callback_->OnEncodedImage(frame, &codec_specific_info, header.get()); 733 callback_->OnEncodedImage(frame, &codec_specific_info, header.get());
730 if (res.error != EncodedImageCallback::Result::OK) { 734 if (res.error != EncodedImageCallback::Result::OK) {
731 LOG(LS_ERROR) << "Encode callback failed: " << res.error; 735 LOG(LS_ERROR) << "Encode callback failed: " << res.error;
732 return; 736 return;
733 } 737 }
734 bitrate_adjuster_.Update(frame._length); 738 bitrate_adjuster_.Update(frame._length);
735 } 739 }
736 740
737 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings() 741 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings()
738 const { 742 const {
739 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold, 743 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold,
740 internal::kHighH264QpThreshold); 744 internal::kHighH264QpThreshold);
741 } 745 }
742 } // namespace webrtc 746 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h ('k') | webrtc/test/call_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698