-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding an initial AV1 encoder implementation for CRD
This is a simple CL which adds a do-nothing impl and the integration points needed for instantiating an AV1 encoder instance from the client. I'm splitting this up as there is a fair amount of overlap in the logic needed for VPX and AV1 (perhaps not surprising) so I wanted to get this piece in first and then refactor the VPX encoder so more of it can be shared between these two SW encoders. Bug: b:217468304 Change-Id: I51f0cf6248f091332389cc9ddc3d0faa84f59a68 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3633114 Commit-Queue: Joe Downing <joedow@chromium.org> Reviewed-by: James Zern <jzern@google.com> Reviewed-by: Lambros Lambrou <lambroslambrou@chromium.org> Cr-Commit-Position: refs/heads/main@{#1002876}
- Loading branch information
Showing
11 changed files
with
133 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "remoting/codec/webrtc_video_encoder_av1.h" | ||
|
||
#include "base/callback.h" | ||
#include "base/notreached.h" | ||
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | ||
|
||
namespace remoting { | ||
|
||
namespace { | ||
|
||
void DestroyAomCodecContext(aom_codec_ctx_t* codec_ctx) { | ||
// Codec has been initialized so we need to destroy it. | ||
auto error = aom_codec_destroy(codec_ctx); | ||
DCHECK_EQ(error, AOM_CODEC_OK); | ||
delete codec_ctx; | ||
} | ||
|
||
} // namespace | ||
|
||
WebrtcVideoEncoderAV1::WebrtcVideoEncoderAV1() | ||
: codec_(nullptr, DestroyAomCodecContext) {} | ||
WebrtcVideoEncoderAV1::~WebrtcVideoEncoderAV1() = default; | ||
|
||
void WebrtcVideoEncoderAV1::SetLosslessEncode(bool want_lossless) {} | ||
|
||
void WebrtcVideoEncoderAV1::SetLosslessColor(bool want_lossless) {} | ||
|
||
void WebrtcVideoEncoderAV1::Encode(std::unique_ptr<webrtc::DesktopFrame> frame, | ||
const FrameParams& params, | ||
EncodeCallback done) { | ||
NOTIMPLEMENTED(); | ||
std::move(done).Run(EncodeResult::UNKNOWN_ERROR, nullptr); | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_AV1_H_ | ||
#define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_AV1_H_ | ||
|
||
#include "base/callback.h" | ||
#include "remoting/codec/webrtc_video_encoder.h" | ||
#include "third_party/libaom/source/libaom/aom/aom_encoder.h" | ||
#include "third_party/libaom/source/libaom/aom/aomcx.h" | ||
|
||
namespace remoting { | ||
|
||
// AV1 encoder implementation for WebRTC transport, params are optimized for | ||
// real-time screen sharing. | ||
class WebrtcVideoEncoderAV1 : public WebrtcVideoEncoder { | ||
public: | ||
WebrtcVideoEncoderAV1(); | ||
WebrtcVideoEncoderAV1(const WebrtcVideoEncoderAV1&) = delete; | ||
WebrtcVideoEncoderAV1& operator=(const WebrtcVideoEncoderAV1&) = delete; | ||
~WebrtcVideoEncoderAV1() override; | ||
|
||
// WebrtcVideoEncoder interface. | ||
void SetLosslessEncode(bool want_lossless) override; | ||
void SetLosslessColor(bool want_lossless) override; | ||
void Encode(std::unique_ptr<webrtc::DesktopFrame> frame, | ||
const FrameParams& params, | ||
EncodeCallback done) override; | ||
|
||
private: | ||
using aom_codec_unique_ptr = | ||
std::unique_ptr<aom_codec_ctx_t, void (*)(aom_codec_ctx_t*)>; | ||
|
||
aom_codec_unique_ptr codec_; | ||
}; | ||
|
||
} // namespace remoting | ||
|
||
#endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_AV1_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters