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

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

Issue 2522553002: RtpPacketizer::NextPacket fills RtpPacket instead of payload. (Closed)
Patch Set: Named kTheMagicSix Created 4 years 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(FrameType frame_type, size_t max_payload_len);
29 30
30 virtual ~RtpPacketizerH264(); 31 virtual ~RtpPacketizerH264();
31 32
32 void SetPayloadData(const uint8_t* payload_data, 33 void SetPayloadData(const uint8_t* payload_data,
33 size_t payload_size, 34 size_t payload_size,
34 const RTPFragmentationHeader* fragmentation) override; 35 const RTPFragmentationHeader* fragmentation) override;
35 36
36 // Get the next payload with H264 payload header. 37 // Get the next payload with H264 payload header.
37 // buffer is a pointer to where the output will be written. 38 // Write payload and set marker bit of the |packet|.
38 // bytes_to_send is an output variable that will contain number of bytes 39 // The parameter |last_packet| is true for the last packet of the frame, false
39 // written to buffer. The parameter last_packet is true for the last packet of 40 // otherwise (i.e., call the function again to get the next packet).
40 // the frame, false otherwise (i.e., call the function again to get the 41 // Returns true on success, false otherwise.
41 // next packet). 42 bool NextPacket(RtpPacketToSend* rtp_packet, bool* last_packet) override;
42 // Returns true on success or false if there was no payload to packetize.
43 bool NextPacket(uint8_t* buffer,
44 size_t* bytes_to_send,
45 bool* last_packet) override;
46 43
47 ProtectionType GetProtectionType() override; 44 ProtectionType GetProtectionType() override;
48 45
49 StorageType GetStorageType(uint32_t retransmission_settings) override; 46 StorageType GetStorageType(uint32_t retransmission_settings) override;
50 47
51 std::string ToString() override; 48 std::string ToString() override;
52 49
53 private: 50 private:
54 // Input fragments (NAL units), with an optionally owned temporary buffer, 51 // Input fragments (NAL units), with an optionally owned temporary buffer,
55 // used in case the fragment gets modified. 52 // used in case the fragment gets modified.
(...skipping 26 matching lines...) Expand all
82 const Fragment source_fragment; 79 const Fragment source_fragment;
83 bool first_fragment; 80 bool first_fragment;
84 bool last_fragment; 81 bool last_fragment;
85 bool aggregated; 82 bool aggregated;
86 uint8_t header; 83 uint8_t header;
87 }; 84 };
88 85
89 void GeneratePackets(); 86 void GeneratePackets();
90 void PacketizeFuA(size_t fragment_index); 87 void PacketizeFuA(size_t fragment_index);
91 size_t PacketizeStapA(size_t fragment_index); 88 size_t PacketizeStapA(size_t fragment_index);
92 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send); 89 void NextAggregatePacket(RtpPacketToSend* rtp_packet);
93 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send); 90 void NextFragmentPacket(RtpPacketToSend* rtp_packet);
94 91
95 const size_t max_payload_len_; 92 const size_t max_payload_len_;
96 std::deque<Fragment> input_fragments_; 93 std::deque<Fragment> input_fragments_;
97 std::queue<PacketUnit> packets_; 94 std::queue<PacketUnit> packets_;
98 95
99 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); 96 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264);
100 }; 97 };
101 98
102 // Depacketizer for H264. 99 // Depacketizer for H264.
103 class RtpDepacketizerH264 : public RtpDepacketizer { 100 class RtpDepacketizerH264 : public RtpDepacketizer {
(...skipping 10 matching lines...) Expand all
114 const uint8_t* payload_data); 111 const uint8_t* payload_data);
115 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload, 112 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
116 const uint8_t* payload_data); 113 const uint8_t* payload_data);
117 114
118 size_t offset_; 115 size_t offset_;
119 size_t length_; 116 size_t length_;
120 std::unique_ptr<rtc::Buffer> modified_buffer_; 117 std::unique_ptr<rtc::Buffer> modified_buffer_;
121 }; 118 };
122 } // namespace webrtc 119 } // namespace webrtc
123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ 120 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format.h ('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