Files
platform-external-webrtc/webrtc/media/engine/internalencoderfactory.cc
hta 9aa96889a3 Reland of H.264 packetization mode 0 (try 3) (patchset #1 id:1 of https://codereview.webrtc.org/2558453002/ )
Reason for revert:
Fixed timeouts in slow tests

Original issue's description:
> Revert of H.264 packetization mode 0 (try 3) (patchset #13 id:490001 of https://codereview.webrtc.org/2528343002/ )
>
> Reason for revert:
> Failures on the Linux Memcheck bot
>
> Original issue's description:
> > This approach passes packetization mode to the encoder as part of
> > a cricket::VideoCodec structure, rather than as part of struct VideoCodecH264 inside webrtc::VideoCodec.
> >
> > BUG=600254
> >
> > Committed: https://crrev.com/e59647b991f61cf1cf61b020356705e6c0f81257
> > Cr-Commit-Position: refs/heads/master@{#15437}
>
> TBR=hbos@webrtc.org,sprang@webrtc.org,mflodman@webrtc.org,magjed@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=600254
>
> Committed: https://crrev.com/243a0a7a7fd6b5da1e32df31f1bfbb6a68dc09f3
> Cr-Commit-Position: refs/heads/master@{#15441}

TBR=hbos@webrtc.org,sprang@webrtc.org,mflodman@webrtc.org,magjed@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=600254

Review-Url: https://codereview.webrtc.org/2558463002
Cr-Commit-Position: refs/heads/master@{#15445}
2016-12-06 13:36:13 +00:00

91 lines
3.1 KiB
C++

/*
* Copyright (c) 2016 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 "webrtc/media/engine/internalencoderfactory.h"
#include <utility>
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
#include "webrtc/system_wrappers/include/field_trial.h"
namespace cricket {
namespace {
const char kFlexfecFieldTrialName[] = "WebRTC-FlexFEC-03";
bool IsFlexfecFieldTrialEnabled() {
return webrtc::field_trial::FindFullName(kFlexfecFieldTrialName) == "Enabled";
}
} // namespace
InternalEncoderFactory::InternalEncoderFactory() {
supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName));
if (webrtc::VP9Encoder::IsSupported())
supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName));
if (webrtc::H264Encoder::IsSupported()) {
cricket::VideoCodec codec(kH264CodecName);
// TODO(magjed): Move setting these parameters into webrtc::H264Encoder
// instead.
codec.SetParam(kH264FmtpProfileLevelId,
kH264ProfileLevelConstrainedBaseline);
codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1");
supported_codecs_.push_back(std::move(codec));
}
supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName));
supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName));
if (IsFlexfecFieldTrialEnabled()) {
cricket::VideoCodec flexfec_codec(kFlexfecCodecName);
// This value is currently arbitrarily set to 10 seconds. (The unit
// is microseconds.) This parameter MUST be present in the SDP, but
// we never use the actual value anywhere in our code however.
// TODO(brandtr): Consider honouring this value in the sender and receiver.
flexfec_codec.SetParam(kFlexfecFmtpRepairWindow, "10000000");
supported_codecs_.push_back(flexfec_codec);
}
}
InternalEncoderFactory::~InternalEncoderFactory() {}
// WebRtcVideoEncoderFactory implementation.
webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
const cricket::VideoCodec& codec) {
const webrtc::VideoCodecType codec_type =
webrtc::PayloadNameToCodecType(codec.name)
.value_or(webrtc::kVideoCodecUnknown);
switch (codec_type) {
case webrtc::kVideoCodecH264:
return webrtc::H264Encoder::Create(codec);
case webrtc::kVideoCodecVP8:
return webrtc::VP8Encoder::Create();
case webrtc::kVideoCodecVP9:
return webrtc::VP9Encoder::Create();
default:
return nullptr;
}
}
const std::vector<cricket::VideoCodec>&
InternalEncoderFactory::supported_codecs() const {
return supported_codecs_;
}
void InternalEncoderFactory::DestroyVideoEncoder(
webrtc::VideoEncoder* encoder) {
delete encoder;
}
} // namespace cricket