Chromium Code Reviews

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_h264.h

Issue 2500743002: Revert of H.264 packetization mode 0 (try 2) (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_
13 13
14 #include <deque> 14 #include <deque>
15 #include <memory>
16 #include <queue> 15 #include <queue>
17 #include <string> 16 #include <string>
18 17
19 #include "webrtc/base/buffer.h" 18 #include "webrtc/base/buffer.h"
20 #include "webrtc/base/constructormagic.h" 19 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
22 21
23 namespace webrtc { 22 namespace webrtc {
24 23
25 class RtpPacketizerH264 : public RtpPacketizer { 24 class RtpPacketizerH264 : public RtpPacketizer {
26 public: 25 public:
27 // Initialize with payload from encoder. 26 // Initialize with payload from encoder.
28 // The payload_data must be exactly one encoded H264 frame. 27 // The payload_data must be exactly one encoded H264 frame.
29 RtpPacketizerH264(size_t max_payload_len, 28 RtpPacketizerH264(FrameType frame_type, size_t max_payload_len);
30 H264PacketizationMode packetization_mode);
31 29
32 virtual ~RtpPacketizerH264(); 30 virtual ~RtpPacketizerH264();
33 31
34 void SetPayloadData(const uint8_t* payload_data, 32 void SetPayloadData(const uint8_t* payload_data,
35 size_t payload_size, 33 size_t payload_size,
36 const RTPFragmentationHeader* fragmentation) override; 34 const RTPFragmentationHeader* fragmentation) override;
37 35
38 // Get the next payload with H264 payload header. 36 // Get the next payload with H264 payload header.
39 // buffer is a pointer to where the output will be written. 37 // buffer is a pointer to where the output will be written.
40 // bytes_to_send is an output variable that will contain number of bytes 38 // bytes_to_send is an output variable that will contain number of bytes
(...skipping 43 matching lines...)
84 const Fragment source_fragment; 82 const Fragment source_fragment;
85 bool first_fragment; 83 bool first_fragment;
86 bool last_fragment; 84 bool last_fragment;
87 bool aggregated; 85 bool aggregated;
88 uint8_t header; 86 uint8_t header;
89 }; 87 };
90 88
91 void GeneratePackets(); 89 void GeneratePackets();
92 void PacketizeFuA(size_t fragment_index); 90 void PacketizeFuA(size_t fragment_index);
93 size_t PacketizeStapA(size_t fragment_index); 91 size_t PacketizeStapA(size_t fragment_index);
94 void PacketizeSingleNalu(size_t fragment_index);
95 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send); 92 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send);
96 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send); 93 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send);
97 94
98 const size_t max_payload_len_; 95 const size_t max_payload_len_;
99 const H264PacketizationMode packetization_mode_;
100 std::deque<Fragment> input_fragments_; 96 std::deque<Fragment> input_fragments_;
101 std::queue<PacketUnit> packets_; 97 std::queue<PacketUnit> packets_;
102 98
103 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); 99 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264);
104 }; 100 };
105 101
106 // Depacketizer for H264. 102 // Depacketizer for H264.
107 class RtpDepacketizerH264 : public RtpDepacketizer { 103 class RtpDepacketizerH264 : public RtpDepacketizer {
108 public: 104 public:
109 RtpDepacketizerH264(); 105 RtpDepacketizerH264();
110 virtual ~RtpDepacketizerH264(); 106 virtual ~RtpDepacketizerH264();
111 107
112 bool Parse(ParsedPayload* parsed_payload, 108 bool Parse(ParsedPayload* parsed_payload,
113 const uint8_t* payload_data, 109 const uint8_t* payload_data,
114 size_t payload_data_length) override; 110 size_t payload_data_length) override;
115 111
116 private: 112 private:
117 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload, 113 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
118 const uint8_t* payload_data); 114 const uint8_t* payload_data);
119 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload, 115 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
120 const uint8_t* payload_data); 116 const uint8_t* payload_data);
121 117
122 size_t offset_; 118 size_t offset_;
123 size_t length_; 119 size_t length_;
124 std::unique_ptr<rtc::Buffer> modified_buffer_; 120 std::unique_ptr<rtc::Buffer> modified_buffer_;
125 }; 121 };
126 } // namespace webrtc 122 } // namespace webrtc
127 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ 123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc » ('j') | no next file with comments »

Powered by Google App Engine