From 6425bdc37aef8a3416d4f8e3847010de9a151ace Mon Sep 17 00:00:00 2001 From: ZHEQIUSHUI <46700201+ZHEQIUSHUI@users.noreply.github.com> Date: Wed, 24 May 2023 11:07:36 +0800 Subject: [PATCH] Update H265Source.cpp to fix ffplay [Illegal temporal ID in RTP/HEVC packet0] --- src/xop/H265Source.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/xop/H265Source.cpp b/src/xop/H265Source.cpp index be325fb..66ffdab 100644 --- a/src/xop/H265Source.cpp +++ b/src/xop/H265Source.cpp @@ -51,6 +51,22 @@ bool H265Source::HandleFrame(MediaChannelId channelId, AVFrame frame) { uint8_t *frame_buf = frame.buffer.get(); uint32_t frame_size = frame.size; + + if ((frame_buf[0] == 0x00) && + (frame_buf[1] == 0x00) && + (frame_buf[2] == 0x00) && + (frame_buf[3] == 0x01)) + { + frame_buf = frame_buf + 4; + frame_size = frame_size - 4; + } + else if ((frame_buf[0] == 0x00) && + (frame_buf[1] == 0x00) && + (frame_buf[2] == 0x01)) + { + frame_buf = frame_buf + 3; + frame_size = frame_size - 3; + } if (frame.timestamp == 0) { frame.timestamp = GetTimestamp();