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

Side by Side Diff: webrtc/common_video/h264/sps_vui_rewriter.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: Addressed comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 *
10 */
11
12 #ifndef WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_
13 #define WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_
14
15 #include "webrtc/base/buffer.h"
16 #include "webrtc/base/optional.h"
17 #include "webrtc/common_video/h264/sps_parser.h"
18
19 namespace rtc {
20 class BitBuffer;
21 }
22
23 namespace webrtc {
24
25 // A class that can parse an SPS block of a NAL unit and if necessary
26 // creates a copy with updated settings to allow for faster decoding for streams
27 // that use picture order count type 0. Streams in that format incur additional
28 // delay because it allows decode order to differ from render order.
29 // The mechanism used is to rewrite (edit or add) the SPS's VUI to contain
30 // restrictions on the maximum number of reordered pictures. This reduces
31 // latency significantly, though it still adds about a frame of latency to
32 // decoding.
33 class SpsVuiRewriter : private SpsParser {
34 public:
35 enum class ParseResult { kFailure, kPocOk, kVuiOk, kVuiRewritten };
36
37 // Parses an SPS block and if necessary copies it and rewrites the VUI.
38 // Returns kFailure on failure, kParseOk if parsing succeeded and no update
39 // was necessary and kParsedAndModified if an updated copy of buffer was
40 // written to destination. destination may be populated with some data even if
41 // no rewrite was necessary, but the end offset should remain unchanged.
42 // Unless parsing fails, the sps parameter will be populated with the parsed
43 // SPS state. This function assumes that any previous headers
44 // (NALU start, type, Stap-A, etc) have already been parsed and that RBSP
45 // decoding has been performed.
46 static ParseResult ParseAndRewriteSps(const uint8_t* buffer,
47 size_t length,
48 rtc::Optional<SpsParser::SpsState>* sps,
49 rtc::Buffer* destination);
50 };
51
52 } // namespace webrtc
53
54 #endif // WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/sps_parser_unittest.cc ('k') | webrtc/common_video/h264/sps_vui_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698