diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h')
-rw-r--r-- | third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h b/third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h new file mode 100644 index 0000000000..21601562c5 --- /dev/null +++ b/third_party/libwebrtc/modules/video_coding/h26x_packet_buffer.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021 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 MODULES_VIDEO_CODING_H26X_PACKET_BUFFER_H_ +#define MODULES_VIDEO_CODING_H26X_PACKET_BUFFER_H_ + +#include <array> +#include <memory> +#include <vector> + +#include "absl/base/attributes.h" +#include "absl/types/optional.h" +#include "modules/video_coding/packet_buffer.h" +#include "rtc_base/numerics/sequence_number_unwrapper.h" + +namespace webrtc { + +class H26xPacketBuffer { + public: + // The H26xPacketBuffer does the same job as the PacketBuffer but for H264 and + // H265 only. To make it fit in with surronding code the PacketBuffer + // input/output classes are used. + using Packet = video_coding::PacketBuffer::Packet; + using InsertResult = video_coding::PacketBuffer::InsertResult; + + // |h264_idr_only_keyframes_allowed| is ignored if H.265 is used. + explicit H26xPacketBuffer(bool h264_idr_only_keyframes_allowed); + + ABSL_MUST_USE_RESULT InsertResult + InsertPacket(std::unique_ptr<Packet> packet); + + private: + static constexpr int kBufferSize = 2048; + + std::unique_ptr<Packet>& GetPacket(int64_t unwrapped_seq_num); + bool BeginningOfStream(const Packet& packet) const; + std::vector<std::unique_ptr<Packet>> FindFrames(int64_t unwrapped_seq_num); + bool MaybeAssembleFrame(int64_t start_seq_num_unwrapped, + int64_t end_sequence_number_unwrapped, + std::vector<std::unique_ptr<Packet>>& packets); + + const bool h264_idr_only_keyframes_allowed_; + std::array<std::unique_ptr<Packet>, kBufferSize> buffer_; + absl::optional<int64_t> last_continuous_unwrapped_seq_num_; + SeqNumUnwrapper<uint16_t> seq_num_unwrapper_; +}; + +} // namespace webrtc + +#endif // MODULES_VIDEO_CODING_H26X_PACKET_BUFFER_H_ |