summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/common_video/video_frame.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/libwebrtc/webrtc/common_video/video_frame.cc
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/webrtc/common_video/video_frame.cc')
-rw-r--r--third_party/libwebrtc/webrtc/common_video/video_frame.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/third_party/libwebrtc/webrtc/common_video/video_frame.cc b/third_party/libwebrtc/webrtc/common_video/video_frame.cc
new file mode 100644
index 0000000000..c7e72c0a52
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/common_video/video_frame.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012 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.
+ */
+
+#include "common_video/include/video_frame.h"
+
+#include <string.h>
+
+#include <algorithm> // swap
+
+#include "rtc_base/bind.h"
+#include "rtc_base/checks.h"
+
+namespace webrtc {
+
+// FFmpeg's decoder, used by H264DecoderImpl, requires up to 8 bytes padding due
+// to optimized bitstream readers. See avcodec_decode_video2.
+const size_t EncodedImage::kBufferPaddingBytesH264 = 8;
+
+size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) {
+ switch (codec_type) {
+ case kVideoCodecVP8:
+ case kVideoCodecVP9:
+ return 0;
+ case kVideoCodecH264:
+ return kBufferPaddingBytesH264;
+ case kVideoCodecI420:
+ case kVideoCodecRED:
+ case kVideoCodecULPFEC:
+ case kVideoCodecFlexfec:
+ case kVideoCodecGeneric:
+ case kVideoCodecUnknown:
+ return 0;
+ }
+ RTC_NOTREACHED();
+ return 0;
+}
+
+EncodedImage::EncodedImage() : EncodedImage(nullptr, 0, 0) {}
+
+EncodedImage::EncodedImage(uint8_t* buffer, size_t length, size_t size)
+ : _buffer(buffer), _length(length), _size(size) {}
+
+void EncodedImage::SetEncodeTime(int64_t encode_start_ms,
+ int64_t encode_finish_ms) {
+ timing_.encode_start_ms = encode_start_ms;
+ timing_.encode_finish_ms = encode_finish_ms;
+}
+} // namespace webrtc