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

Commit 676fad3

Browse files
authored
Correctly set generic descriptor for HEVC. (#182)
1 parent ccba81e commit 676fad3

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

call/rtp_payload_params.cc

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -315,21 +315,6 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
315315
int64_t frame_id,
316316
bool is_keyframe,
317317
RTPVideoHeader* rtp_video_header) {
318-
if (codec_specific_info->codecType == webrtc::kVideoCodecH265 &&
319-
codec_specific_info->codecSpecific.H265.picture_id > 0) {
320-
// H265ToGeneric implementation. Only set it when picture id is valid.
321-
rtp_video_header->generic->frame_id =
322-
codec_specific_info->codecSpecific.H265.picture_id;
323-
rtp_video_header->generic->spatial_index = 0; // Not enabled at present.
324-
rtp_video_header->generic->temporal_index = 0; // Not enabled at present.
325-
for (int dep_idx = 0; dep_idx < 5; dep_idx++) {
326-
if (codec_specific_info->codecSpecific.H265.dependencies[dep_idx] <= 0)
327-
break;
328-
rtp_video_header->generic->dependencies[dep_idx] =
329-
codec_specific_info->codecSpecific.H265.dependencies[dep_idx];
330-
}
331-
return;
332-
}
333318
if (codec_specific_info && codec_specific_info->generic_frame_info &&
334319
!codec_specific_info->generic_frame_info->encoder_buffers.empty()) {
335320
// If generic frame info is provided for other codecs, use generic frame
@@ -369,8 +354,12 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
369354
is_keyframe, rtp_video_header);
370355
}
371356
return;
372-
// No further special handling for H.265
373357
case VideoCodecType::kVideoCodecH265:
358+
if (codec_specific_info) {
359+
H265ToGeneric(codec_specific_info->codecSpecific.H265, frame_id,
360+
is_keyframe, rtp_video_header);
361+
}
362+
return;
374363
case VideoCodecType::kVideoCodecMultiplex:
375364
return;
376365
}
@@ -517,6 +506,26 @@ void RtpPayloadParams::H264ToGeneric(const CodecSpecificInfoH264& h264_info,
517506
last_shared_frame_id_[/*spatial_index*/ 0][temporal_index] = shared_frame_id;
518507
}
519508

509+
void RtpPayloadParams::H265ToGeneric(const CodecSpecificInfoH265& h265_info,
510+
int64_t shared_frame_id,
511+
bool is_keyframe,
512+
RTPVideoHeader* rtp_video_header) {
513+
if (h265_info.picture_id <= 0) {
514+
RTC_LOG(LS_WARNING) << "Invalid HEVC picture ID.";
515+
return;
516+
}
517+
RTPVideoHeader::GenericDescriptorInfo& generic =
518+
rtp_video_header->generic.emplace();
519+
generic.frame_id = h265_info.picture_id;
520+
generic.spatial_index = 0; // Not enabled at present.
521+
generic.temporal_index = 0; // Not enabled at present.
522+
for (int dep_idx = 0; dep_idx < 5; dep_idx++) {
523+
if (h265_info.dependencies[dep_idx] <= 0)
524+
break;
525+
generic.dependencies[dep_idx] = h265_info.dependencies[dep_idx];
526+
}
527+
}
528+
520529
void RtpPayloadParams::Vp8ToGeneric(const CodecSpecificInfoVP8& vp8_info,
521530
int64_t shared_frame_id,
522531
bool is_keyframe,

call/rtp_payload_params.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class RtpPayloadParams final {
7373
int64_t shared_frame_id,
7474
bool is_keyframe,
7575
RTPVideoHeader* rtp_video_header);
76+
void H265ToGeneric(const CodecSpecificInfoH265& h265_info,
77+
int64_t shared_frame_id,
78+
bool is_keyframe,
79+
RTPVideoHeader* rtp_video_header);
7680

7781
void GenericToGeneric(int64_t shared_frame_id,
7882
bool is_keyframe,

0 commit comments

Comments
 (0)