Reason for revert: Breaks chromium.fyi test: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec Original issue's description: > Stop using hardcoded payload types for video codecs > > This CL stops using hardcoded payload types for different video codecs > and will dynamically assign them payload types incrementally from 96 to > 127 instead. > > This CL: > * Replaces 'std::vector<VideoCodec> DefaultVideoCodecList()' in > webrtcvideoengine2.cc with an explicit WebRtcVideoEncoderFactory for > internally supported software codecs instead. The purpose is to > streamline the payload type assignment in webrtcvideoengine2.cc which > will now have two encoder factories of the same > WebRtcVideoEncoderFactory type; one internal and one external. > * Removes webrtc::VideoEncoder::EncoderType and use cricket::VideoCodec > instead. > * Removes 'static VideoEncoder* Create(EncoderType codec_type)' and > moves the create function to the internal encoder factory instead. > * Removes video_encoder.cc. webrtc::VideoEncoder is now just an > interface without any static functions. > * The function GetSupportedCodecs in webrtcvideoengine2.cc unifies > the internal and external codecs and assigns them payload types > incrementally from 96 to 127. > * Updates webrtcvideoengine2_unittest.cc and removes assumptions about > what payload types will be used. > > BUG=webrtc:6677,webrtc:6705 > R=hta@webrtc.org, ossu@webrtc.org, stefan@webrtc.org > > Committed: https://crrev.com/42043b95872b51321f508bf255d804ce3dff366b > Cr-Commit-Position: refs/heads/master@{#15135} TBR=hta@webrtc.org,stefan@webrtc.org,ossu@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6677,webrtc:6705 Review-Url: https://codereview.webrtc.org/2513633002 Cr-Commit-Position: refs/heads/master@{#15140}
77 lines
2.6 KiB
C++
77 lines
2.6 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.
|
|
*/
|
|
|
|
#ifndef WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_
|
|
#define WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "webrtc/video_encoder.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// Class used to wrap external VideoEncoders to provide a fallback option on
|
|
// software encoding when a hardware encoder fails to encode a stream due to
|
|
// hardware restrictions, such as max resolution.
|
|
class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
|
|
public:
|
|
VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type,
|
|
webrtc::VideoEncoder* encoder);
|
|
|
|
int32_t InitEncode(const VideoCodec* codec_settings,
|
|
int32_t number_of_cores,
|
|
size_t max_payload_size) override;
|
|
|
|
int32_t RegisterEncodeCompleteCallback(
|
|
EncodedImageCallback* callback) override;
|
|
|
|
int32_t Release() override;
|
|
int32_t Encode(const VideoFrame& frame,
|
|
const CodecSpecificInfo* codec_specific_info,
|
|
const std::vector<FrameType>* frame_types) override;
|
|
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
|
|
int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
|
|
uint32_t framerate) override;
|
|
void OnDroppedFrame() override;
|
|
bool SupportsNativeHandle() const override;
|
|
|
|
private:
|
|
bool InitFallbackEncoder();
|
|
|
|
// Settings used in the last InitEncode call and used if a dynamic fallback to
|
|
// software is required.
|
|
VideoCodec codec_settings_;
|
|
int32_t number_of_cores_;
|
|
size_t max_payload_size_;
|
|
|
|
// The last bitrate/framerate set, and a flag for noting they are set.
|
|
bool rates_set_;
|
|
BitrateAllocation bitrate_allocation_;
|
|
uint32_t framerate_;
|
|
|
|
// The last channel parameters set, and a flag for noting they are set.
|
|
bool channel_parameters_set_;
|
|
uint32_t packet_loss_;
|
|
int64_t rtt_;
|
|
|
|
const EncoderType encoder_type_;
|
|
webrtc::VideoEncoder* const encoder_;
|
|
|
|
std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
|
|
std::string fallback_implementation_name_;
|
|
EncodedImageCallback* callback_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_
|