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

Fix h265 pub/sub failure caused by RTP packetizer/depacketizer. #35

Merged
merged 3 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions call/rtp_payload_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ void PopulateRtpWithCodecSpecifics(const CodecSpecificInfo& info,
}
return;
}
#ifndef DISABLE_H265
case kVideoCodecH265: {
auto h265_header = rtp->video_type_header.emplace<RTPVideoHeaderH265>();
h265_header.packetization_mode =
info.codecSpecific.H265.packetization_mode;
}
return;
#endif
case kVideoCodecMultiplex:
case kVideoCodecGeneric:
rtp->codec = kVideoCodecGeneric;
Expand Down
5 changes: 3 additions & 2 deletions modules/rtp_rtcp/source/rtp_format_h265.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool RtpPacketizerH265::PacketizeFu(size_t fragment_index) {
// Strip out the original header and leave room for the FU header.
const Fragment& fragment = input_fragments_[fragment_index];
PayloadSizeLimits limits = limits_;
limits.max_payload_len -= kHevcFuHeaderSize;
limits.max_payload_len -= kHevcFuHeaderSize + kHevcNalHeaderSize;

// Update single/first/last packet reductions unless it is single/first/last
// fragment.
Expand Down Expand Up @@ -202,10 +202,11 @@ bool RtpPacketizerH265::PacketizeFu(size_t fragment_index) {
for (size_t i = 0; i < payload_sizes.size(); ++i) {
int packet_length = payload_sizes[i];
RTC_CHECK_GT(packet_length, 0);
uint16_t header = (fragment.buffer[0] << 8) | fragment.buffer[1];
packets_.push(PacketUnit(Fragment(fragment.buffer + offset, packet_length),
/*first_fragment=*/i == 0,
/*last_fragment=*/i == payload_sizes.size() - 1,
false, fragment.buffer[0]));
false, header));
offset += packet_length;
payload_left -= packet_length;
}
Expand Down
11 changes: 11 additions & 0 deletions modules/video_coding/include/video_codec_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,23 @@ struct CodecSpecificInfoH264 {
bool base_layer_sync;
bool idr_frame;
};

#ifndef DISABLE_H265
struct CodecSpecificInfoH265 {
H265PacketizationMode packetization_mode;
bool idr_frame;
};
#endif

static_assert(std::is_pod<CodecSpecificInfoH264>::value, "");

union CodecSpecificInfoUnion {
CodecSpecificInfoVP8 VP8;
CodecSpecificInfoVP9 VP9;
CodecSpecificInfoH264 H264;
#ifndef DISABLE_H265
CodecSpecificInfoH265 H265;
#endif
};
static_assert(std::is_pod<CodecSpecificInfoUnion>::value, "");

Expand Down
5 changes: 5 additions & 0 deletions modules/video_coding/packet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ VCMPacket::VCMPacket(const uint8_t* ptr,
markerBit(rtp_header.markerBit),
timesNacked(-1),
completeNALU(kNaluIncomplete),
#ifndef DISABLE_H265
insertStartCode((videoHeader.codec == kVideoCodecH264 || videoHeader.codec == kVideoCodecH265) &&
videoHeader.is_first_packet_in_frame),
#else
insertStartCode(videoHeader.codec == kVideoCodecH264 &&
videoHeader.is_first_packet_in_frame),
#endif
video_header(videoHeader) {
if (is_first_packet_in_frame() && markerBit) {
completeNALU = kNaluComplete;
Expand Down
4 changes: 3 additions & 1 deletion modules/video_coding/packet_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,10 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
bool has_h264_pps = false;
bool has_h264_idr = false;
bool is_h264_keyframe = false;

bool is_h265 = false;
#ifndef DISABLE_H265
bool is_h265 = data_buffer_[start_index].codec() == kVideoCodecH265;
is_h265 = data_buffer_[start_index].codec() == kVideoCodecH265;
bool has_h265_sps = false;
bool has_h265_pps = false;
bool has_h265_idr = false;
Expand Down