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

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

Issue 2809653004: Revert of Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: 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;
368 // We can only set average bitrate on the HW encoder. 367 // We can only set average bitrate on the HW encoder.
369 target_bitrate_bps_ = codec_settings->startBitrate; 368 target_bitrate_bps_ = codec_settings->startBitrate;
370 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_); 369 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_);
371 370
372 // TODO(tkchin): Try setting payload size via 371 // TODO(tkchin): Try setting payload size via
373 // kVTCompressionPropertyKey_MaxH264SliceBytes. 372 // kVTCompressionPropertyKey_MaxH264SliceBytes.
374 373
375 return ResetCompressionSession(); 374 return ResetCompressionSession();
376 } 375 }
377 376
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size()); 715 webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size());
717 frame._encodedWidth = width; 716 frame._encodedWidth = width;
718 frame._encodedHeight = height; 717 frame._encodedHeight = height;
719 frame._completeFrame = true; 718 frame._completeFrame = true;
720 frame._frameType = 719 frame._frameType =
721 is_keyframe ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta; 720 is_keyframe ? webrtc::kVideoFrameKey : webrtc::kVideoFrameDelta;
722 frame.capture_time_ms_ = render_time_ms; 721 frame.capture_time_ms_ = render_time_ms;
723 frame._timeStamp = timestamp; 722 frame._timeStamp = timestamp;
724 frame.rotation_ = rotation; 723 frame.rotation_ = rotation;
725 724
726 frame.content_type_ =
727 (mode_ == kScreensharing) ? VideoContentType::SCREENSHARE : VideoContentTy pe::UNSPECIFIED;
728
729 h264_bitstream_parser_.ParseBitstream(buffer->data(), buffer->size()); 725 h264_bitstream_parser_.ParseBitstream(buffer->data(), buffer->size());
730 h264_bitstream_parser_.GetLastSliceQp(&frame.qp_); 726 h264_bitstream_parser_.GetLastSliceQp(&frame.qp_);
731 727
732 EncodedImageCallback::Result res = 728 EncodedImageCallback::Result res =
733 callback_->OnEncodedImage(frame, &codec_specific_info, header.get()); 729 callback_->OnEncodedImage(frame, &codec_specific_info, header.get());
734 if (res.error != EncodedImageCallback::Result::OK) { 730 if (res.error != EncodedImageCallback::Result::OK) {
735 LOG(LS_ERROR) << "Encode callback failed: " << res.error; 731 LOG(LS_ERROR) << "Encode callback failed: " << res.error;
736 return; 732 return;
737 } 733 }
738 bitrate_adjuster_.Update(frame._length); 734 bitrate_adjuster_.Update(frame._length);
739 } 735 }
740 736
741 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings() 737 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings()
742 const { 738 const {
743 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold, 739 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold,
744 internal::kHighH264QpThreshold); 740 internal::kHighH264QpThreshold);
745 } 741 }
746 } // namespace webrtc 742 } // 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