From e6cf0a8601759048a33711ce1a27269da6e87ff1 Mon Sep 17 00:00:00 2001 From: Michel Promonet Date: Sat, 28 Sep 2024 22:18:14 +0200 Subject: [PATCH] fix build with latest webrtc sdk --- inc/V4l2Capturer.h | 3 ++- inc/livevideosource.h | 6 ++++-- inc/rtmpvideosource.h | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/V4l2Capturer.h b/inc/V4l2Capturer.h index 4e7db572..e3e1ba46 100644 --- a/inc/V4l2Capturer.h +++ b/inc/V4l2Capturer.h @@ -103,7 +103,8 @@ class V4l2Capturer : public VideoSource bool idr = false; int cfg = 0; - std::vector naluIndexes = webrtc::H264::FindNaluIndices((uint8_t*)buffer, frameSize); + rtc::ArrayView data((const uint8_t*)buffer, frameSize); + std::vector naluIndexes = webrtc::H264::FindNaluIndices(data); for (webrtc::H264::NaluIndex index : naluIndexes) { webrtc::H264::NaluType nalu_type = webrtc::H264::ParseNaluType(buffer[index.payload_start_offset]); RTC_LOG(LS_VERBOSE) << __FUNCTION__ << " nalu:" << nalu_type << " payload_start_offset:" << index.payload_start_offset << " start_offset:" << index.start_offset << " size:" << index.payload_size; diff --git a/inc/livevideosource.h b/inc/livevideosource.h index 64a23fe4..f89f03eb 100644 --- a/inc/livevideosource.h +++ b/inc/livevideosource.h @@ -104,7 +104,8 @@ class LiveVideoSource : public VideoDecoder, public T::Callback } void onH264Data(unsigned char *buffer, ssize_t size, int64_t ts, const std::string & codec) { - std::vector indexes = webrtc::H264::FindNaluIndices(buffer,size); + rtc::ArrayView data(buffer, size); + std::vector indexes = webrtc::H264::FindNaluIndices(data); RTC_LOG(LS_VERBOSE) << "LiveVideoSource:onData nbNalu:" << indexes.size(); for (const webrtc::H264::NaluIndex & index : indexes) { webrtc::H264::NaluType nalu_type = webrtc::H264::ParseNaluType(buffer[index.payload_start_offset]); @@ -115,7 +116,8 @@ class LiveVideoSource : public VideoDecoder, public T::Callback m_cfg.clear(); m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset); - std::optional sps = webrtc::SpsParser::ParseSps(buffer + index.payload_start_offset + webrtc::H264::kNaluTypeSize, index.payload_size - webrtc::H264::kNaluTypeSize); + rtc::ArrayView spsBuffer(buffer + index.payload_start_offset + webrtc::H264::kNaluTypeSize, index.payload_size - webrtc::H264::kNaluTypeSize); + std::optional sps = webrtc::SpsParser::ParseSps(spsBuffer); if (!sps) { RTC_LOG(LS_ERROR) << "cannot parse sps"; diff --git a/inc/rtmpvideosource.h b/inc/rtmpvideosource.h index 4aad84af..f8edb197 100644 --- a/inc/rtmpvideosource.h +++ b/inc/rtmpvideosource.h @@ -124,7 +124,8 @@ class RtmpVideoSource : public VideoDecoder { m_cfg.clear(); RTC_LOG(LS_INFO) << "RtmpVideoSource::onNewSession H264 SPS size:" << spssize; - std::optional sps = webrtc::SpsParser::ParseSps((const unsigned char*)(&body[start_sps+3]), spssize); + rtc::ArrayView spsBuffer((const unsigned char*)(&body[start_sps+3]), spssize); + std::optional sps = webrtc::SpsParser::ParseSps(spsBuffer); if (!sps) { RTC_LOG(LS_ERROR) << "cannot parse H264 sps";