From 9217a5dbcd5ae713e775529b9ab4c21ac81fbad2 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Fri, 9 Jul 2021 14:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/H264.cpp | 5 ++--- src/Extension/H265.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Extension/H264.cpp b/src/Extension/H264.cpp index 60f8ac2a..fdd962c9 100644 --- a/src/Extension/H264.cpp +++ b/src/Extension/H264.cpp @@ -146,8 +146,7 @@ bool H264Track::ready() { void H264Track::inputFrame(const Frame::Ptr &frame) { using H264FrameInternal = FrameInternal; - - int type = H264_TYPE(*((uint8_t *) frame->data() + frame->prefixSize())); + int type = H264_TYPE( frame->data()[frame->prefixSize()]); if (type != H264Frame::NAL_B_P && type != H264Frame::NAL_IDR) { //非I/B/P帧情况下,split一下,防止多个帧粘合在一起 splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) { @@ -171,7 +170,7 @@ Track::Ptr H264Track::clone() { } void H264Track::inputFrame_l(const Frame::Ptr &frame){ - int type = H264_TYPE(*((uint8_t *) frame->data() + frame->prefixSize())); + int type = H264_TYPE( frame->data()[frame->prefixSize()]); switch (type) { case H264Frame::NAL_SPS: { _sps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize()); diff --git a/src/Extension/H265.cpp b/src/Extension/H265.cpp index 53cf7a8f..ac023706 100644 --- a/src/Extension/H265.cpp +++ b/src/Extension/H265.cpp @@ -91,8 +91,7 @@ bool H265Track::ready() { void H265Track::inputFrame(const Frame::Ptr &frame) { using H265FrameInternal = FrameInternal; - - int type = H265_TYPE(*((uint8_t *) frame->data() + frame->prefixSize())); + int type = H265_TYPE( frame->data()[frame->prefixSize()]); if (frame->configFrame() || type == H265Frame::NAL_SEI_PREFIX) { splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, size_t len, size_t prefix) { H265FrameInternal::Ptr sub_frame = std::make_shared(frame, (char *) ptr, len, prefix); @@ -113,7 +112,7 @@ void H265Track::inputFrame_l(const Frame::Ptr &frame) { _is_idr = false; //非idr帧 - switch (H265_TYPE(((uint8_t *) frame->data() + frame->prefixSize())[0])) { + switch (H265_TYPE( frame->data()[frame->prefixSize()])) { case H265Frame::NAL_VPS: { _vps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize()); break;