勉强完成延迟很高
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace aethera::web {
|
||||
@@ -12,10 +14,20 @@ enum class Video_Pixel_Layout : std::uint8_t {
|
||||
rgba
|
||||
};
|
||||
|
||||
enum class Video_Encoder_Backend : std::uint8_t {
|
||||
nvenc,
|
||||
vulkan_video
|
||||
};
|
||||
|
||||
[[nodiscard]] std::string_view video_encoder_backend_name(
|
||||
Video_Encoder_Backend backend) noexcept;
|
||||
[[nodiscard]] std::string_view h264_profile_level_id() noexcept;
|
||||
|
||||
struct Encoded_Video_Frame {
|
||||
std::vector<std::byte> annex_b{}; /* 带起始码的完整 H.264 access unit,可直接交给 RTP packetizer。 */
|
||||
std::chrono::microseconds presentation_time{}; /* 从 Plot 帧时钟起点累计的媒体时间戳。 */
|
||||
std::uint64_t sequence{}; /* 对应 Render_Frame 的单调序号。 */
|
||||
Video_Encoder_Backend backend{Video_Encoder_Backend::nvenc}; /* 实际产生本 access unit 的硬件编码后端。 */
|
||||
bool key_frame{}; /* 本 access unit 是否可独立解码。 */
|
||||
};
|
||||
|
||||
@@ -26,7 +38,7 @@ public:
|
||||
H264_Encoder(const H264_Encoder&) = delete;
|
||||
H264_Encoder& operator=(const H264_Encoder&) = delete;
|
||||
void request_key_frame();
|
||||
[[nodiscard]] std::shared_ptr<const Encoded_Video_Frame> encode(
|
||||
[[nodiscard]] std::optional<Encoded_Video_Frame> encode(
|
||||
std::span<const std::byte> pixels, std::uint32_t width,
|
||||
std::uint32_t height, Video_Pixel_Layout layout,
|
||||
std::uint64_t sequence, std::chrono::microseconds presentation_time);
|
||||
|
||||
Reference in New Issue
Block a user