mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00

This reverts commit31c5c9da35
. Reason for revert: made QP parser thread-safe https://webrtc.googlesource.com/src/+/0e42cf703bd111fde235d06d08b02d3a7b02c727 Original change's description: > Revert "Reland "Enable quality scaling when allowed"" > > This reverts commit0021fe7793
. > > Reason for revert: Broken on linux_tsan bot: https://ci.chromium.org/ui/p/webrtc/builders/ci/Linux%20Tsan%20v2/25329/overview > > Original change's description: > > Reland "Enable quality scaling when allowed" > > > > This reverts commiteb449a979b
. > > > > Reason for revert: Added QP parsing in https://webrtc.googlesource.com/src/+/8639673f0c098efc294a7593fa3bd98e28ab7508 > > > > Original change's description: > > Before this CL quality scaling was conditioned on scaling settings > > provided by encoder. That should not be a requirement since encoder > > may not be aware of quality scaling which is a WebRTC feature. In M90 > > chromium HW encoders do not provide scaling settings (chromium:1179020). > > The default scaling settings provided by these encoders are not correct > > (b/181537172). > > > > This CL adds is_quality_scaling_allowed to VideoEncoderConfig. The flag > > is set to true in singlecast with normal video feed (not screen sharing) > > mode. If quality scaling is allowed it is enabled no matter whether > > scaling settings are present in encoder info or not. Setting from > > QualityScalingExperiment are used in case if not provided by encoder. > > > > Bug: chromium:1179020 > > Bug: webrtc:12511 > > Change-Id: I97911fde9005ec25028a640a3f007d12f2bbc2e5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211349 > > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33438} > > TBR=brandtr@webrtc.org,ilnik@webrtc.org,ssilkin@webrtc.org,rubber-stamper@appspot.gserviceaccount.com > > Change-Id: Id7633a1e98f95762e81487887f83a0c35f89195c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:1179020 > Bug: webrtc:12511 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211352 > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33439} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: chromium:1179020 Bug: webrtc:12511 Change-Id: I3a31e1c1fdf7da93226f8c1e0a96b43fe0b786df Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212026 Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33481}
146 lines
4.5 KiB
C++
146 lines
4.5 KiB
C++
/*
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#include "api/video_codecs/video_encoder_config.h"
|
|
|
|
#include <string>
|
|
|
|
#include "rtc_base/checks.h"
|
|
#include "rtc_base/strings/string_builder.h"
|
|
|
|
namespace webrtc {
|
|
VideoStream::VideoStream()
|
|
: width(0),
|
|
height(0),
|
|
max_framerate(-1),
|
|
min_bitrate_bps(-1),
|
|
target_bitrate_bps(-1),
|
|
max_bitrate_bps(-1),
|
|
scale_resolution_down_by(-1.),
|
|
max_qp(-1),
|
|
num_temporal_layers(absl::nullopt),
|
|
active(true) {}
|
|
VideoStream::VideoStream(const VideoStream& other) = default;
|
|
|
|
VideoStream::~VideoStream() = default;
|
|
|
|
std::string VideoStream::ToString() const {
|
|
char buf[1024];
|
|
rtc::SimpleStringBuilder ss(buf);
|
|
ss << "{width: " << width;
|
|
ss << ", height: " << height;
|
|
ss << ", max_framerate: " << max_framerate;
|
|
ss << ", min_bitrate_bps:" << min_bitrate_bps;
|
|
ss << ", target_bitrate_bps:" << target_bitrate_bps;
|
|
ss << ", max_bitrate_bps:" << max_bitrate_bps;
|
|
ss << ", max_qp: " << max_qp;
|
|
ss << ", num_temporal_layers: " << num_temporal_layers.value_or(1);
|
|
ss << ", bitrate_priority: " << bitrate_priority.value_or(0);
|
|
ss << ", active: " << active;
|
|
ss << ", scale_down_by: " << scale_resolution_down_by;
|
|
|
|
return ss.str();
|
|
}
|
|
|
|
VideoEncoderConfig::VideoEncoderConfig()
|
|
: codec_type(kVideoCodecGeneric),
|
|
video_format("Unset"),
|
|
content_type(ContentType::kRealtimeVideo),
|
|
encoder_specific_settings(nullptr),
|
|
min_transmit_bitrate_bps(0),
|
|
max_bitrate_bps(0),
|
|
bitrate_priority(1.0),
|
|
number_of_streams(0),
|
|
legacy_conference_mode(false),
|
|
is_quality_scaling_allowed(false) {}
|
|
|
|
VideoEncoderConfig::VideoEncoderConfig(VideoEncoderConfig&&) = default;
|
|
|
|
VideoEncoderConfig::~VideoEncoderConfig() = default;
|
|
|
|
std::string VideoEncoderConfig::ToString() const {
|
|
char buf[1024];
|
|
rtc::SimpleStringBuilder ss(buf);
|
|
ss << "{codec_type: ";
|
|
ss << CodecTypeToPayloadString(codec_type);
|
|
ss << ", content_type: ";
|
|
switch (content_type) {
|
|
case ContentType::kRealtimeVideo:
|
|
ss << "kRealtimeVideo";
|
|
break;
|
|
case ContentType::kScreen:
|
|
ss << "kScreenshare";
|
|
break;
|
|
}
|
|
ss << ", encoder_specific_settings: ";
|
|
ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
|
|
|
|
ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
|
|
ss << '}';
|
|
return ss.str();
|
|
}
|
|
|
|
VideoEncoderConfig::VideoEncoderConfig(const VideoEncoderConfig&) = default;
|
|
|
|
void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
|
|
VideoCodec* codec) const {
|
|
if (codec->codecType == kVideoCodecH264) {
|
|
FillVideoCodecH264(codec->H264());
|
|
} else if (codec->codecType == kVideoCodecVP8) {
|
|
FillVideoCodecVp8(codec->VP8());
|
|
} else if (codec->codecType == kVideoCodecVP9) {
|
|
FillVideoCodecVp9(codec->VP9());
|
|
} else {
|
|
RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
|
|
}
|
|
}
|
|
|
|
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
|
|
VideoCodecH264* h264_settings) const {
|
|
RTC_NOTREACHED();
|
|
}
|
|
|
|
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
|
|
VideoCodecVP8* vp8_settings) const {
|
|
RTC_NOTREACHED();
|
|
}
|
|
|
|
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
|
|
VideoCodecVP9* vp9_settings) const {
|
|
RTC_NOTREACHED();
|
|
}
|
|
|
|
VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(
|
|
const VideoCodecH264& specifics)
|
|
: specifics_(specifics) {}
|
|
|
|
void VideoEncoderConfig::H264EncoderSpecificSettings::FillVideoCodecH264(
|
|
VideoCodecH264* h264_settings) const {
|
|
*h264_settings = specifics_;
|
|
}
|
|
|
|
VideoEncoderConfig::Vp8EncoderSpecificSettings::Vp8EncoderSpecificSettings(
|
|
const VideoCodecVP8& specifics)
|
|
: specifics_(specifics) {}
|
|
|
|
void VideoEncoderConfig::Vp8EncoderSpecificSettings::FillVideoCodecVp8(
|
|
VideoCodecVP8* vp8_settings) const {
|
|
*vp8_settings = specifics_;
|
|
}
|
|
|
|
VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
|
|
const VideoCodecVP9& specifics)
|
|
: specifics_(specifics) {}
|
|
|
|
void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
|
|
VideoCodecVP9* vp9_settings) const {
|
|
*vp9_settings = specifics_;
|
|
}
|
|
|
|
} // namespace webrtc
|