blob: 61c548cf4960a3b24aa7c5fc06564a3da92ced04 [file] [log] [blame]
philipel34852cf2016-11-03 04:03:01 -07001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_H264_SPS_PPS_TRACKER_H_
12#define MODULES_VIDEO_CODING_H264_SPS_PPS_TRACKER_H_
philipel34852cf2016-11-03 04:03:01 -070013
14#include <cstdint>
15#include <map>
16#include <memory>
philipel022b54e2016-12-20 04:15:59 -080017#include <vector>
philipel34852cf2016-11-03 04:03:01 -070018
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "modules/include/module_common_types.h"
philipel34852cf2016-11-03 04:03:01 -070020
21namespace webrtc {
22
23class VCMPacket;
24
25namespace video_coding {
26
27class H264SpsPpsTracker {
28 public:
philipela75d12d2016-11-07 05:11:28 -080029 enum PacketAction { kInsert, kDrop, kRequestKeyframe };
30
31 PacketAction CopyAndFixBitstream(VCMPacket* packet);
johand2b092f2017-01-24 02:38:17 -080032
33 void InsertSpsPpsNalus(const std::vector<uint8_t>& sps,
34 const std::vector<uint8_t>& pps);
philipel34852cf2016-11-03 04:03:01 -070035
36 private:
37 struct PpsInfo {
38 int sps_id = -1;
39 size_t size = 0;
40 std::unique_ptr<uint8_t[]> data;
41 };
42
43 struct SpsInfo {
44 size_t size = 0;
philipel6585f702017-03-17 06:12:33 -070045 int width = -1;
46 int height = -1;
philipel34852cf2016-11-03 04:03:01 -070047 std::unique_ptr<uint8_t[]> data;
48 };
49
50 std::map<uint32_t, PpsInfo> pps_data_;
51 std::map<uint32_t, SpsInfo> sps_data_;
52};
53
54} // namespace video_coding
55} // namespace webrtc
56
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020057#endif // MODULES_VIDEO_CODING_H264_SPS_PPS_TRACKER_H_