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

Commit cb00a61

Browse files
taste1981jianjunz
authored andcommitted
Set generic frame descriptor extension for HEVC (#95)
1 parent 2af2266 commit cb00a61

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

call/rtp_payload_params.cc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,32 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
317317
int64_t frame_id,
318318
bool is_keyframe,
319319
RTPVideoHeader* rtp_video_header) {
320-
if (codec_specific_info && codec_specific_info->generic_frame_info &&
320+
321+
#ifdef WEBRTC_USE_H265
322+
if (codec_specific_info->codecType == webrtc::kVideoCodecH265 &&
323+
codec_specific_info->codecSpecific.H265.picture_id > 0) {
324+
// H265ToGeneric implementation. Only set it when picture id is valid.
325+
rtp_video_header->generic->frame_id =
326+
codec_specific_info->codecSpecific.H265.picture_id;
327+
rtp_video_header->generic->discardable =
328+
codec_specific_info->codecSpecific.H265.discardable;
329+
rtp_video_header->generic->spatial_index = 0; // Not enabled at present.
330+
rtp_video_header->generic->temporal_index = 0; // Not enabled at present.
331+
for (int dep_idx = 0; dep_idx < 5; dep_idx++) {
332+
if (codec_specific_info->codecSpecific.H265.dependencies[dep_idx] <= 0)
333+
break;
334+
rtp_video_header->generic->dependencies[dep_idx] =
335+
codec_specific_info->codecSpecific.H265.dependencies[dep_idx];
336+
}
337+
// Not filling DTIs at present.
338+
rtp_video_header->generic->discardable =
339+
codec_specific_info->codecSpecific.H265.discardable;
340+
return;
341+
}
342+
#else
343+
if (codec_specific_info && codec_specific_info->generic_frame_info &&
321344
!codec_specific_info->generic_frame_info->encoder_buffers.empty()) {
345+
// If generic frame info is provided for other codecs, use generic frame info.
322346
if (is_keyframe) {
323347
// Key frame resets all chains it is in.
324348
chains_calculator_.Reset(
@@ -328,6 +352,8 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
328352
*codec_specific_info->generic_frame_info, frame_id);
329353
return;
330354
}
355+
#endif
356+
331357

332358
switch (rtp_video_header->codec) {
333359
case VideoCodecType::kVideoCodecGeneric:
@@ -355,6 +381,7 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
355381
}
356382
return;
357383
#ifndef DISABLE_H265
384+
// No further special handling for H.265
358385
case VideoCodecType::kVideoCodecH265:
359386
#endif
360387
case VideoCodecType::kVideoCodecMultiplex:

modules/video_coding/include/video_codec_interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ struct CodecSpecificInfoH265 {
100100
bool idr_frame;
101101
bool last_fragment_in_frame;
102102
int16_t picture_id;
103+
int dependencies[5];
104+
int dtis[10];
105+
bool discardable;
103106
};
104107
#endif
105108

0 commit comments

Comments
 (0)