Encoder switching based on network and/or resolution conditions.

In this CL:
 - Renamed EncoderFailureCallback to EncoderSwitchRequestCallback. An encoder
   switch request can now also be made with a configuration that specifies which
   codec/implementation to switch to.
 - Added "WebRTC-NetworkCondition-EncoderSwitch" field trial that specifies
   switching conditions and desired codec to switch to.
 - Added checks to trigger the switch based on these conditions.

Bug: webrtc:10795
Change-Id: I9d3a9a39a7c4827915a40bdceed10b581d70b90a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151900
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29196}
This commit is contained in:
philipel
2019-09-16 14:53:40 +02:00
committed by Commit Bot
parent 73ceed58f8
commit d9cc8c08dc
7 changed files with 411 additions and 17 deletions

View File

@ -11,16 +11,29 @@
#ifndef API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_
#define API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_
#include <string>
#include "api/video/video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_factory.h"
namespace webrtc {
class EncoderFailureCallback {
class EncoderSwitchRequestCallback {
public:
virtual ~EncoderFailureCallback() {}
virtual void OnEncoderFailure() = 0;
virtual ~EncoderSwitchRequestCallback() {}
struct Config {
std::string codec_name;
absl::optional<std::string> param;
absl::optional<std::string> value;
};
// Requests that encoder fallback is performed.
virtual void RequestEncoderFallback() = 0;
// Requests that a switch to a specific encoder is performed.
virtual void RequestEncoderSwitch(const Config& conf) = 0;
};
struct VideoStreamEncoderSettings {
@ -35,8 +48,8 @@ struct VideoStreamEncoderSettings {
// Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
VideoEncoderFactory* encoder_factory = nullptr;
// Notifies the WebRtcVideoChannel that the currently used encoder is broken.
EncoderFailureCallback* encoder_failure_callback = nullptr;
// Requests the WebRtcVideoChannel to perform a codec switch.
EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr;
// Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr;