Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: webrtc/modules/rtp_rtcp/source/h264/h264_common.h

Issue 1979443004: Add H264 bitstream rewriting to limit frame reordering marker in header (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rewriting on the receiver side as well Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/h264/h264_common.h
diff --git a/webrtc/modules/rtp_rtcp/source/h264/h264_common.h b/webrtc/modules/rtp_rtcp/source/h264/h264_common.h
new file mode 100644
index 0000000000000000000000000000000000000000..71d4d32baa7f1be4b7a8b8a78cd0c4bdffbd2431
--- /dev/null
+++ b/webrtc/modules/rtp_rtcp/source/h264/h264_common.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_H264_H264_COMMON_H_
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_H264_H264_COMMON_H_
+
+#include <memory>
+#include <vector>
+
+#include "webrtc/base/common.h"
+#include "webrtc/base/bytebuffer.h"
+
+namespace webrtc {
+
+class H264Common {
+ public:
+ // The size of a NALU header {0 0 0 1}.
noahric 2016/05/18 01:35:06 Three byte start codes are also valid, but assumin
sprang_webrtc 2016/05/20 16:11:00 I think this has worked because the standard manda
+ static const size_t kNaluHeaderSize;
+
+ // The size of a NALU header plus the type byte.
+ static const size_t kNaluHeaderAndTypeSize;
+
+ enum NaluType : uint8_t { kSps = 0x7, kPps = 0x8, kIdr = 0x5 };
noahric 2016/05/18 01:35:07 While you are here, add Sei, in case someone needs
sprang_webrtc 2016/05/20 16:11:00 Done.
+ enum SliceType : uint8_t { P = 0, B = 1, I = 2, Sp = 3, Si = 4 };
+
+ // Returns a vector of the NALU start sequences (0 0 0 1) in the given buffer.
noahric 2016/05/18 01:35:06 My bad (it was my comment originally), but I'd rep
sprang_webrtc 2016/05/20 16:11:00 Changed this to contain both offset of nal header
+ static std::vector<size_t> FindNaluStartOffsets(const uint8_t* buffer,
+ size_t buffer_size);
+ static NaluType ParseNaluType(uint8_t data);
noahric 2016/05/18 01:35:07 Comments for these would help.
sprang_webrtc 2016/05/20 16:11:00 Done.
+ static std::unique_ptr<rtc::ByteBufferWriter> ParseRbsp(const uint8_t* data,
+ size_t length);
+ static void WriteRbsp(const uint8_t* bytes,
+ size_t length,
+ rtc::ByteBufferWriter* destination);
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_H264_H264_COMMON_H_

Powered by Google App Engine
This is Rietveld 408576698