mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00

This reverts commit a2655449ee
.
Reason for revert: H265 tests must be hidden behind RTC_ENABLE_H265.
Original change's description:
> Add HEVC support for h264_packet_buffer.
>
> Renamed to h26x_packet_buffer as it also supports HEVC now. For HEVC,
> start code is added by depacktizer, and remote endpoint must send
> sequence and picture information in-band.
>
> Co-authored-by: Qiujiao Wu <qiujiao.wu@intel.com>
>
> Bug: webrtc:13485
> Change-Id: I321cb223357d8d15da95cec80ec0c3a43c26734e
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/333863
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Commit-Queue: Philip Eliasson <philipel@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41739}
Bug: webrtc:13485
Change-Id: I64660d73ef0d790b25622ce882aab3db63facf26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339861
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41742}
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
/*
|
|
* 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_H264_PACKET_BUFFER_H_
|
|
#define MODULES_VIDEO_CODING_H264_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 H264PacketBuffer {
|
|
public:
|
|
// The H264PacketBuffer does the same job as the PacketBuffer but for H264
|
|
// 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;
|
|
|
|
explicit H264PacketBuffer(bool 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 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_H264_PACKET_BUFFER_H_
|