webrtc_m130/api/video_codecs/video_codec.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

204 lines
6.2 KiB
C++
Raw Permalink Normal View History

/*
* Copyright (c) 2012 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_codec.h"
#include <string.h>
#include <optional>
#include <string>
#include "absl/strings/match.h"
#include "api/video/video_codec_type.h"
#include "api/video_codecs/scalability_mode.h"
#include "api/video_codecs/simulcast_stream.h"
#include "rtc_base/checks.h"
Reland "Extends WebRTC logs for software encoder fallback" This is a reland of commit 050ffefd854f8a57071992238723259e9ae0d85a Original change's description: > Extends WebRTC logs for software encoder fallback > > This CL extends logging related to HW->SW fallbacks on the encoder > side in WebRTC. The goal is to make it easier to track down the > different steps taken when setting up the video encoder and why/when > HW encoding fails. > > Current logs are added on several lines which makes regexp searching > difficult. This CL adds all related information on one line instead. > > Three new search tags are also added VSE (VideoStreamEncoder), VESFW > (VideoEncoderSoftwareFallbackWrapper) and SEA (SimulcastEncoderAdapter). The idea is to allow searching for the tags to see correlated logs. > > It has been verified that these added logs also show up in WebRTC > logs in Meet. > > Logs from the GPU process are not included due to the sandboxed > nature which makes it much more complex to add to the native > WebRTC log. I think that these simple logs will provide value as is. > > Example: https://gist.github.com/henrik-and/41946f7f0b10774241bd14d7687f770b > > Bug: b/322132132 > Change-Id: Iec58c9741a9dd6bab3236a88e9a6e45440f5d980 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339260 > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#41733} NOTRY=true Bug: b/322132132 Change-Id: I25dd34b9ba59ea8502e47b4c89cd111430636e08 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41736}
2024-02-14 18:08:26 +01:00
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
namespace {
constexpr char kPayloadNameVp8[] = "VP8";
constexpr char kPayloadNameVp9[] = "VP9";
constexpr char kPayloadNameAv1[] = "AV1";
// TODO(bugs.webrtc.org/13166): Remove AV1X when backwards compatibility is not
// needed.
constexpr char kPayloadNameAv1x[] = "AV1X";
constexpr char kPayloadNameH264[] = "H264";
constexpr char kPayloadNameGeneric[] = "Generic";
constexpr char kPayloadNameH265[] = "H265";
} // namespace
bool VideoCodecVP8::operator==(const VideoCodecVP8& other) const {
return (numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
automaticResizeOn == other.automaticResizeOn &&
keyFrameInterval == other.keyFrameInterval);
}
bool VideoCodecVP9::operator==(const VideoCodecVP9& other) const {
return (numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
keyFrameInterval == other.keyFrameInterval &&
adaptiveQpMode == other.adaptiveQpMode &&
automaticResizeOn == other.automaticResizeOn &&
numberOfSpatialLayers == other.numberOfSpatialLayers &&
flexibleMode == other.flexibleMode);
}
bool VideoCodecH264::operator==(const VideoCodecH264& other) const {
return (keyFrameInterval == other.keyFrameInterval &&
numberOfTemporalLayers == other.numberOfTemporalLayers);
}
VideoCodec::VideoCodec()
: codecType(kVideoCodecGeneric),
width(0),
height(0),
startBitrate(0),
maxBitrate(0),
minBitrate(0),
maxFramerate(0),
active(true),
qpMax(0),
numberOfSimulcastStreams(0),
simulcastStream(),
spatialLayers(),
mode(VideoCodecMode::kRealtimeVideo),
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
expect_encode_from_texture(false),
timing_frame_thresholds({0, 0}),
legacy_conference_mode(false),
codec_specific_(),
complexity_(VideoCodecComplexity::kComplexityNormal) {}
Reland "Extends WebRTC logs for software encoder fallback" This is a reland of commit 050ffefd854f8a57071992238723259e9ae0d85a Original change's description: > Extends WebRTC logs for software encoder fallback > > This CL extends logging related to HW->SW fallbacks on the encoder > side in WebRTC. The goal is to make it easier to track down the > different steps taken when setting up the video encoder and why/when > HW encoding fails. > > Current logs are added on several lines which makes regexp searching > difficult. This CL adds all related information on one line instead. > > Three new search tags are also added VSE (VideoStreamEncoder), VESFW > (VideoEncoderSoftwareFallbackWrapper) and SEA (SimulcastEncoderAdapter). The idea is to allow searching for the tags to see correlated logs. > > It has been verified that these added logs also show up in WebRTC > logs in Meet. > > Logs from the GPU process are not included due to the sandboxed > nature which makes it much more complex to add to the native > WebRTC log. I think that these simple logs will provide value as is. > > Example: https://gist.github.com/henrik-and/41946f7f0b10774241bd14d7687f770b > > Bug: b/322132132 > Change-Id: Iec58c9741a9dd6bab3236a88e9a6e45440f5d980 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339260 > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#41733} NOTRY=true Bug: b/322132132 Change-Id: I25dd34b9ba59ea8502e47b4c89cd111430636e08 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41736}
2024-02-14 18:08:26 +01:00
std::string VideoCodec::ToString() const {
char string_buf[2048];
SimpleStringBuilder ss(string_buf);
Reland "Extends WebRTC logs for software encoder fallback" This is a reland of commit 050ffefd854f8a57071992238723259e9ae0d85a Original change's description: > Extends WebRTC logs for software encoder fallback > > This CL extends logging related to HW->SW fallbacks on the encoder > side in WebRTC. The goal is to make it easier to track down the > different steps taken when setting up the video encoder and why/when > HW encoding fails. > > Current logs are added on several lines which makes regexp searching > difficult. This CL adds all related information on one line instead. > > Three new search tags are also added VSE (VideoStreamEncoder), VESFW > (VideoEncoderSoftwareFallbackWrapper) and SEA (SimulcastEncoderAdapter). The idea is to allow searching for the tags to see correlated logs. > > It has been verified that these added logs also show up in WebRTC > logs in Meet. > > Logs from the GPU process are not included due to the sandboxed > nature which makes it much more complex to add to the native > WebRTC log. I think that these simple logs will provide value as is. > > Example: https://gist.github.com/henrik-and/41946f7f0b10774241bd14d7687f770b > > Bug: b/322132132 > Change-Id: Iec58c9741a9dd6bab3236a88e9a6e45440f5d980 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339260 > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#41733} NOTRY=true Bug: b/322132132 Change-Id: I25dd34b9ba59ea8502e47b4c89cd111430636e08 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41736}
2024-02-14 18:08:26 +01:00
ss << "VideoCodec {" << "type: " << CodecTypeToPayloadString(codecType)
<< ", mode: "
<< (mode == VideoCodecMode::kRealtimeVideo ? "RealtimeVideo"
: "Screensharing");
if (IsSinglecast()) {
std::optional<ScalabilityMode> scalability_mode = GetScalabilityMode();
Reland "Extends WebRTC logs for software encoder fallback" This is a reland of commit 050ffefd854f8a57071992238723259e9ae0d85a Original change's description: > Extends WebRTC logs for software encoder fallback > > This CL extends logging related to HW->SW fallbacks on the encoder > side in WebRTC. The goal is to make it easier to track down the > different steps taken when setting up the video encoder and why/when > HW encoding fails. > > Current logs are added on several lines which makes regexp searching > difficult. This CL adds all related information on one line instead. > > Three new search tags are also added VSE (VideoStreamEncoder), VESFW > (VideoEncoderSoftwareFallbackWrapper) and SEA (SimulcastEncoderAdapter). The idea is to allow searching for the tags to see correlated logs. > > It has been verified that these added logs also show up in WebRTC > logs in Meet. > > Logs from the GPU process are not included due to the sandboxed > nature which makes it much more complex to add to the native > WebRTC log. I think that these simple logs will provide value as is. > > Example: https://gist.github.com/henrik-and/41946f7f0b10774241bd14d7687f770b > > Bug: b/322132132 > Change-Id: Iec58c9741a9dd6bab3236a88e9a6e45440f5d980 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339260 > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#41733} NOTRY=true Bug: b/322132132 Change-Id: I25dd34b9ba59ea8502e47b4c89cd111430636e08 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41736}
2024-02-14 18:08:26 +01:00
if (scalability_mode.has_value()) {
ss << ", Singlecast: {" << width << "x" << height << " "
<< ScalabilityModeToString(*scalability_mode)
<< (active ? ", active" : ", inactive") << "}";
}
} else {
ss << ", Simulcast: {";
for (size_t i = 0; i < numberOfSimulcastStreams; ++i) {
const SimulcastStream stream = simulcastStream[i];
std::optional<ScalabilityMode> scalability_mode =
stream.GetScalabilityMode();
if (scalability_mode.has_value()) {
ss << "[" << stream.width << "x" << stream.height << " "
<< ScalabilityModeToString(*scalability_mode)
<< (stream.active ? ", active" : ", inactive") << "]";
}
Reland "Extends WebRTC logs for software encoder fallback" This is a reland of commit 050ffefd854f8a57071992238723259e9ae0d85a Original change's description: > Extends WebRTC logs for software encoder fallback > > This CL extends logging related to HW->SW fallbacks on the encoder > side in WebRTC. The goal is to make it easier to track down the > different steps taken when setting up the video encoder and why/when > HW encoding fails. > > Current logs are added on several lines which makes regexp searching > difficult. This CL adds all related information on one line instead. > > Three new search tags are also added VSE (VideoStreamEncoder), VESFW > (VideoEncoderSoftwareFallbackWrapper) and SEA (SimulcastEncoderAdapter). The idea is to allow searching for the tags to see correlated logs. > > It has been verified that these added logs also show up in WebRTC > logs in Meet. > > Logs from the GPU process are not included due to the sandboxed > nature which makes it much more complex to add to the native > WebRTC log. I think that these simple logs will provide value as is. > > Example: https://gist.github.com/henrik-and/41946f7f0b10774241bd14d7687f770b > > Bug: b/322132132 > Change-Id: Iec58c9741a9dd6bab3236a88e9a6e45440f5d980 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339260 > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#41733} NOTRY=true Bug: b/322132132 Change-Id: I25dd34b9ba59ea8502e47b4c89cd111430636e08 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41736}
2024-02-14 18:08:26 +01:00
}
ss << "}";
}
ss << "}";
return ss.str();
}
VideoCodecVP8* VideoCodec::VP8() {
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return &codec_specific_.VP8;
}
const VideoCodecVP8& VideoCodec::VP8() const {
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return codec_specific_.VP8;
}
VideoCodecVP9* VideoCodec::VP9() {
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return &codec_specific_.VP9;
}
const VideoCodecVP9& VideoCodec::VP9() const {
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return codec_specific_.VP9;
}
VideoCodecH264* VideoCodec::H264() {
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return &codec_specific_.H264;
}
const VideoCodecH264& VideoCodec::H264() const {
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ ) > > > > > > Reason for revert: > > > Broke a google3 build > > > > > > Original issue's description: > > > > Declare VideoCodec.codec_specific_info private > > > > > > > > This completes the privatization of the codec specific > > > > information in VideoCodec. > > > > > > > > BUG=webrtc:6603 > > > > > > > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > > > > Cr-Commit-Position: refs/heads/master@{#15013} > > > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:6603 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:6603 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6603 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117}
2016-11-16 23:23:04 -08:00
return codec_specific_.H264;
}
Reland "Add option to disable quality scaling for AV1." This reverts commit 83102d39077f82f2d4539c160c659dcf789a5fdb. Reason for revert: reland with fix Original change's description: > Revert "Add option to disable quality scaling for AV1." > > This reverts commit 446dbc66fde7e9d5e684d3f71e357c2076a91740. > > Reason for revert: downstream break > > Original change's description: > > Add option to disable quality scaling for AV1. > > > > The main goal of this change is to disable the quality scaler when multiple spatial layers are used. > > > > Bug: b/295129711 > > Change-Id: I25e0b7440a8c2adee3e97720a1e0ee5e0a914334 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/319181 > > Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Commit-Queue: Philip Eliasson <philipel@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#40709} > > Bug: b/295129711 > Change-Id: Iaeb13951d1b839bc0426120436035843bb3ee98f > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320081 > Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Philip Eliasson <philipel@webrtc.org> > Owners-Override: Philip Eliasson <philipel@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#40742} Bug: b/295129711 Change-Id: Iab4846c2cd6074f50a3ebe9551432d449243b5d7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320120 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40743}
2023-09-13 14:44:23 +02:00
VideoCodecAV1* VideoCodec::AV1() {
RTC_DCHECK_EQ(codecType, kVideoCodecAV1);
return &codec_specific_.AV1;
}
const VideoCodecAV1& VideoCodec::AV1() const {
RTC_DCHECK_EQ(codecType, kVideoCodecAV1);
return codec_specific_.AV1;
}
const char* CodecTypeToPayloadString(VideoCodecType type) {
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
switch (type) {
case kVideoCodecVP8:
return kPayloadNameVp8;
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
case kVideoCodecVP9:
return kPayloadNameVp9;
case kVideoCodecAV1:
return kPayloadNameAv1;
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
case kVideoCodecH264:
return kPayloadNameH264;
case kVideoCodecGeneric:
return kPayloadNameGeneric;
case kVideoCodecH265:
return kPayloadNameH265;
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
}
RTC_CHECK_NOTREACHED();
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
}
VideoCodecType PayloadStringToCodecType(const std::string& name) {
if (absl::EqualsIgnoreCase(name, kPayloadNameVp8))
return kVideoCodecVP8;
if (absl::EqualsIgnoreCase(name, kPayloadNameVp9))
return kVideoCodecVP9;
if (absl::EqualsIgnoreCase(name, kPayloadNameAv1) ||
absl::EqualsIgnoreCase(name, kPayloadNameAv1x))
return kVideoCodecAV1;
if (absl::EqualsIgnoreCase(name, kPayloadNameH264))
return kVideoCodecH264;
if (absl::EqualsIgnoreCase(name, kPayloadNameH265))
return kVideoCodecH265;
return kVideoCodecGeneric;
}
VideoCodecComplexity VideoCodec::GetVideoEncoderComplexity() const {
return complexity_;
}
void VideoCodec::SetVideoEncoderComplexity(
VideoCodecComplexity complexity_setting) {
complexity_ = complexity_setting;
}
bool VideoCodec::GetFrameDropEnabled() const {
return frame_drop_enabled_;
}
void VideoCodec::SetFrameDropEnabled(bool enabled) {
frame_drop_enabled_ = enabled;
}
} // namespace webrtc