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.

140 lines
4.3 KiB
C++
Raw 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 <string>
#include "absl/strings/match.h"
#include "rtc_base/checks.h"
namespace webrtc {
bool VideoCodecVP8::operator==(const VideoCodecVP8& other) const {
return (complexity == other.complexity &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
automaticResizeOn == other.automaticResizeOn &&
frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval);
}
bool VideoCodecVP9::operator==(const VideoCodecVP9& other) const {
return (complexity == other.complexity &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
adaptiveQpMode == other.adaptiveQpMode &&
automaticResizeOn == other.automaticResizeOn &&
numberOfSpatialLayers == other.numberOfSpatialLayers &&
flexibleMode == other.flexibleMode);
}
bool VideoCodecH264::operator==(const VideoCodecH264& other) const {
return (frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
numberOfTemporalLayers == other.numberOfTemporalLayers);
}
bool SpatialLayer::operator==(const SpatialLayer& other) const {
return (width == other.width && height == other.height &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
maxBitrate == other.maxBitrate &&
targetBitrate == other.targetBitrate &&
minBitrate == other.minBitrate && qpMax == other.qpMax &&
active == other.active);
}
VideoCodec::VideoCodec()
: codecType(kVideoCodecGeneric),
plType(0),
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}),
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
codec_specific_() {}
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 #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
static const char* kPayloadNameVp8 = "VP8";
static const char* kPayloadNameVp9 = "VP9";
static const char* kPayloadNameH264 = "H264";
static const char* kPayloadNameGeneric = "Generic";
static const char* kPayloadNameMultiplex = "Multiplex";
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
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;
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;
// Other codecs default to generic.
default:
return kPayloadNameGeneric;
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, kPayloadNameH264))
return kVideoCodecH264;
if (absl::EqualsIgnoreCase(name, kPayloadNameMultiplex))
return kVideoCodecMultiplex;
return kVideoCodecGeneric;
}
} // namespace webrtc