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

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

Issue 2337453002: H.264 packetization mode 0 (try 2) (Closed)
Patch Set: Upload try 2 (with rebase) Created 4 years, 1 month 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
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>
15 #include <queue> 16 #include <queue>
16 #include <string> 17 #include <string>
17 18
18 #include "webrtc/base/buffer.h" 19 #include "webrtc/base/buffer.h"
19 #include "webrtc/base/constructormagic.h" 20 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class RtpPacketizerH264 : public RtpPacketizer { 25 class RtpPacketizerH264 : public RtpPacketizer {
25 public: 26 public:
26 // Initialize with payload from encoder. 27 // Initialize with payload from encoder.
27 // The payload_data must be exactly one encoded H264 frame. 28 // The payload_data must be exactly one encoded H264 frame.
28 RtpPacketizerH264(FrameType frame_type, size_t max_payload_len); 29 RtpPacketizerH264(size_t max_payload_len,
30 H264PacketizationMode packetization_mode);
29 31
30 virtual ~RtpPacketizerH264(); 32 virtual ~RtpPacketizerH264();
31 33
32 void SetPayloadData(const uint8_t* payload_data, 34 void SetPayloadData(const uint8_t* payload_data,
33 size_t payload_size, 35 size_t payload_size,
34 const RTPFragmentationHeader* fragmentation) override; 36 const RTPFragmentationHeader* fragmentation) override;
35 37
36 // Get the next payload with H264 payload header. 38 // Get the next payload with H264 payload header.
37 // buffer is a pointer to where the output will be written. 39 // buffer is a pointer to where the output will be written.
38 // bytes_to_send is an output variable that will contain number of bytes 40 // bytes_to_send is an output variable that will contain number of bytes
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const Fragment source_fragment; 84 const Fragment source_fragment;
83 bool first_fragment; 85 bool first_fragment;
84 bool last_fragment; 86 bool last_fragment;
85 bool aggregated; 87 bool aggregated;
86 uint8_t header; 88 uint8_t header;
87 }; 89 };
88 90
89 void GeneratePackets(); 91 void GeneratePackets();
90 void PacketizeFuA(size_t fragment_index); 92 void PacketizeFuA(size_t fragment_index);
91 size_t PacketizeStapA(size_t fragment_index); 93 size_t PacketizeStapA(size_t fragment_index);
94 void PacketizeSingleNalu(size_t fragment_index);
92 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send); 95 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send);
93 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send); 96 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send);
94 97
95 const size_t max_payload_len_; 98 const size_t max_payload_len_;
99 const H264PacketizationMode packetization_mode_;
96 std::deque<Fragment> input_fragments_; 100 std::deque<Fragment> input_fragments_;
97 std::queue<PacketUnit> packets_; 101 std::queue<PacketUnit> packets_;
98 102
99 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); 103 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264);
100 }; 104 };
101 105
102 // Depacketizer for H264. 106 // Depacketizer for H264.
103 class RtpDepacketizerH264 : public RtpDepacketizer { 107 class RtpDepacketizerH264 : public RtpDepacketizer {
104 public: 108 public:
105 RtpDepacketizerH264(); 109 RtpDepacketizerH264();
106 virtual ~RtpDepacketizerH264(); 110 virtual ~RtpDepacketizerH264();
107 111
108 bool Parse(ParsedPayload* parsed_payload, 112 bool Parse(ParsedPayload* parsed_payload,
109 const uint8_t* payload_data, 113 const uint8_t* payload_data,
110 size_t payload_data_length) override; 114 size_t payload_data_length) override;
111 115
112 private: 116 private:
113 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload, 117 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
114 const uint8_t* payload_data); 118 const uint8_t* payload_data);
115 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload, 119 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
116 const uint8_t* payload_data); 120 const uint8_t* payload_data);
117 121
118 size_t offset_; 122 size_t offset_;
119 size_t length_; 123 size_t length_;
120 std::unique_ptr<rtc::Buffer> modified_buffer_; 124 std::unique_ptr<rtc::Buffer> modified_buffer_;
121 }; 125 };
122 } // namespace webrtc 126 } // namespace webrtc
123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ 127 #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
This is Rietveld 408576698