Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit efa2192

Browse files
committed
Remove rtp depacketizer workarouds for hevc SC as client stack no longer send SC
Change-Id: I166225be2d52ae1e8d10de76d6b9aacb3c9cd9f0 Reviewed-on: https://git-ccr-1.devtools.intel.com/gerrit/78818 Reviewed-by: Qiu, Jianlin <[email protected]> Tested-by: Qiu, Jianlin <[email protected]>
1 parent d34f58e commit efa2192

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

webrtc/modules/rtp_rtcp/source/rtp_format_h265.cc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,22 @@ static const size_t kHevcLengthFieldSize = 2;
4646
static const size_t kHevcApHeaderSize = kHevcNalHeaderSize + kHevcLengthFieldSize;
4747

4848

49-
enum HevcNalHdrMasks {kHevcFbit = 0x80, kHevcTypeMask= 0x7E, kHevcLayerIDHMask = 0x1,
50-
kHevcLayerIDLMask = 0xF8, kHevcTIDMask = 0x7, kHevcTypeMaskN = 0x81, kHevcTypeMaskInFuHeader=0x3F};
49+
enum HevcNalHdrMasks {
50+
kHevcFbit = 0x80,
51+
kHevcTypeMask= 0x7E,
52+
kHevcLayerIDHMask = 0x1,
53+
kHevcLayerIDLMask = 0xF8,
54+
kHevcTIDMask = 0x7,
55+
kHevcTypeMaskN = 0x81,
56+
kHevcTypeMaskInFuHeader=0x3F
57+
};
5158

5259
// Bit masks for FU headers.
53-
enum HevcFuDefs { kHevcSBit = 0x80, kHevcEBit = 0x40, kHevcFuTypeBit = 0x3F };
60+
enum HevcFuDefs {
61+
kHevcSBit = 0x80,
62+
kHevcEBit = 0x40,
63+
kHevcFuTypeBit = 0x3F
64+
};
5465

5566
bool VerifyApNaluLengths(const uint8_t* nalu_ptr, size_t length_remaining) {
5667
while (length_remaining > 0) {
@@ -74,23 +85,14 @@ bool ParseHevcSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
7485
parsed_payload->type.Video.width = 0;
7586
parsed_payload->type.Video.height = 0;
7687
parsed_payload->type.Video.codec = kRtpVideoH265;
77-
//parsed_payload->type.Video.isFirstPacket = true;
7888
RTPVideoHeaderH265* h265_header =
7989
&parsed_payload->type.Video.codecHeader.H265;
8090

8191
if (payload_data_length <= 4)
8292
return false;
8393

84-
if ((payload_data[0] == 0 && payload_data[1] == 0 && payload_data[2] == 1) ||
85-
(payload_data[0] == 0 && payload_data[1] == 0 && payload_data[2] == 0 && payload_data[3] == 1)) {
86-
uint8_t single_nal_type = (payload_data[2] == 1) ? ((payload_data[3] >> 1) & 0x7F) : ((payload_data[4] >> 1) & 0x7F);
87-
h265_header->packetization_type = kH265SingleNalu;
88-
h265_header->nalu_type = single_nal_type;
89-
parsed_payload->frame_type = kVideoFrameKey;
90-
return true;
91-
}
92-
const uint8_t* nalu_start = payload_data + kHevcNalHeaderSize;
93-
size_t nalu_length = payload_data_length - kHevcNalHeaderSize;
94+
const uint8_t* nalu_start = payload_data /*kHevcNalHeaderSize*/;
95+
size_t nalu_length = payload_data_length /*- kHevcNalHeaderSize*/;
9496
//nal type is at bit 6:1
9597
uint8_t nal_type = (payload_data[0] >>1) & 0x7F;
9698
if (nal_type == kHevcAp) {
@@ -111,6 +113,7 @@ bool ParseHevcSingleNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
111113
nalu_length -= kHevcApHeaderSize;
112114
h265_header->packetization_type = kH265AP;
113115
} else {
116+
parsed_payload->type.Video.is_first_packet_in_frame = true;
114117
h265_header->packetization_type = kH265SingleNalu;
115118
}
116119
h265_header->nalu_type = nal_type;
@@ -179,7 +182,7 @@ bool ParseHevcFuNalu(RtpDepacketizer::ParsedPayload* parsed_payload,
179182
parsed_payload->type.Video.width = 0;
180183
parsed_payload->type.Video.height = 0;
181184
parsed_payload->type.Video.codec = kRtpVideoH265;
182-
//parsed_payload->type.Video.isFirstPacket = first_fragment;
185+
parsed_payload->type.Video.is_first_packet_in_frame = first_fragment;
183186
RTPVideoHeaderH265* h265_header =
184187
&parsed_payload->type.Video.codecHeader.H265;
185188
h265_header->packetization_type = kH265FU;

webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ int32_t RTPReceiverVideo::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
100100

101101
rtp_header->type.Video.playout_delay =
102102
rtp_header->header.extension.playout_delay;
103-
#ifndef DISABLE_H265
104-
if (rtp_header->type.Video.codec == webrtc::kRtpVideoH265)
105-
rtp_header->type.Video.is_first_packet_in_frame = is_first_packet;
106-
#endif
103+
107104
return data_callback_->OnReceivedPayloadData(parsed_payload.payload,
108105
parsed_payload.payload_length,
109106
rtp_header) == 0

webrtc/modules/video_coding/packet.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) {
136136
case kRtpVideoH265:
137137
is_first_packet_in_frame = videoHeader.is_first_packet_in_frame;
138138
if (is_first_packet_in_frame)
139-
insertStartCode = false;
139+
insertStartCode = true;
140140
if (is_first_packet_in_frame && markerBit) {
141141
completeNALU = kNaluComplete;
142142
} else if (is_first_packet_in_frame) {

0 commit comments

Comments
 (0)