| OLD | NEW |
| 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(const RTPVideoHeaderH264& parameters, |
| 30 size_t max_payload_len); |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 92 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send); | 94 void NextAggregatePacket(uint8_t* buffer, size_t* bytes_to_send); |
| 93 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send); | 95 void NextFragmentPacket(uint8_t* buffer, size_t* bytes_to_send); |
| 94 | 96 |
| 97 H264PacketizationMode packetization_mode_; |
| 95 const size_t max_payload_len_; | 98 const size_t max_payload_len_; |
| 96 std::deque<Fragment> input_fragments_; | 99 std::deque<Fragment> input_fragments_; |
| 97 std::queue<PacketUnit> packets_; | 100 std::queue<PacketUnit> packets_; |
| 98 | 101 |
| 99 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); | 102 RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 // Depacketizer for H264. | 105 // Depacketizer for H264. |
| 103 class RtpDepacketizerH264 : public RtpDepacketizer { | 106 class RtpDepacketizerH264 : public RtpDepacketizer { |
| 104 public: | 107 public: |
| 105 RtpDepacketizerH264(); | 108 RtpDepacketizerH264(); |
| 106 virtual ~RtpDepacketizerH264(); | 109 virtual ~RtpDepacketizerH264(); |
| 107 | 110 |
| 108 bool Parse(ParsedPayload* parsed_payload, | 111 bool Parse(ParsedPayload* parsed_payload, |
| 109 const uint8_t* payload_data, | 112 const uint8_t* payload_data, |
| 110 size_t payload_data_length) override; | 113 size_t payload_data_length) override; |
| 111 | 114 |
| 112 private: | 115 private: |
| 113 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload, | 116 bool ParseFuaNalu(RtpDepacketizer::ParsedPayload* parsed_payload, |
| 114 const uint8_t* payload_data); | 117 const uint8_t* payload_data); |
| 115 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload, | 118 bool ProcessStapAOrSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload, |
| 116 const uint8_t* payload_data); | 119 const uint8_t* payload_data); |
| 117 | 120 |
| 118 size_t offset_; | 121 size_t offset_; |
| 119 size_t length_; | 122 size_t length_; |
| 120 std::unique_ptr<rtc::Buffer> modified_buffer_; | 123 std::unique_ptr<rtc::Buffer> modified_buffer_; |
| 121 }; | 124 }; |
| 122 } // namespace webrtc | 125 } // namespace webrtc |
| 123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ | 126 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H264_H_ |
| OLD | NEW |