#ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_ENCODER_FACTORY_H_
#define REMOTING_PROTOCOL_WEBRTC_VIDEO_ENCODER_FACTORY_H_
#include <memory>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/task/single_thread_task_runner.h"
#include "remoting/base/session_options.h"
#include "remoting/protocol/video_stream_event_router.h"
#include "third_party/webrtc/api/video_codecs/av1_profile.h"
#include "third_party/webrtc/api/video_codecs/sdp_video_format.h"
#include "third_party/webrtc/api/video_codecs/video_encoder_factory.h"
#include "third_party/webrtc/api/video_codecs/vp9_profile.h"
#include "third_party/webrtc/modules/video_coding/include/video_codec_interface.h"
namespace remoting::protocol {
class WebrtcVideoEncoderFactory : public webrtc::VideoEncoderFactory {
public:
WebrtcVideoEncoderFactory();
~WebrtcVideoEncoderFactory() override;
std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(
const webrtc::SdpVideoFormat& format) override;
std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const override;
void ApplySessionOptions(const SessionOptions& options);
VideoStreamEventRouter& video_stream_event_router() { return event_router_; }
private:
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
std::vector<webrtc::SdpVideoFormat> supported_formats_{
webrtc::SdpVideoFormat("VP8"),
webrtc::SdpVideoFormat("VP9"),
webrtc::SdpVideoFormat(
"VP9",
{{webrtc::kVP9FmtpProfileId,
webrtc::VP9ProfileToString(webrtc::VP9Profile::kProfile1)}}),
webrtc::SdpVideoFormat("AV1"),
webrtc::SdpVideoFormat(
"AV1",
{{webrtc::kAV1FmtpProfile,
webrtc::AV1ProfileToString(webrtc::AV1Profile::kProfile1)
.data()}})};
SessionOptions session_options_;
VideoStreamEventRouter event_router_;
};
}
#endif