Skip to content

Commit

Permalink
this may fix #607 fixing nalu size when offset is not 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Aug 6, 2023
1 parent a4a794d commit 1018b11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inc/livevideosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class LiveVideoSource : public VideoSourceWithDecoder, public T::Callback
{
RTC_LOG(LS_VERBOSE) << "LiveVideoSource:onData SPS";
m_cfg.clear();
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset - index.start_offset);
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);

absl::optional<webrtc::SpsParser::SpsState> sps = webrtc::SpsParser::ParseSps(buffer + index.payload_start_offset, index.payload_size);
if (!sps)
Expand All @@ -136,7 +136,7 @@ class LiveVideoSource : public VideoSourceWithDecoder, public T::Callback
else if (nalu_type == webrtc::H264::NaluType::kPps)
{
RTC_LOG(LS_VERBOSE) << "LiveVideoSource:onData PPS";
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset - index.start_offset);
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);
}
else if (nalu_type == webrtc::H264::NaluType::kSei)
{
Expand All @@ -160,7 +160,7 @@ class LiveVideoSource : public VideoSourceWithDecoder, public T::Callback
RTC_LOG(LS_ERROR) << "LiveVideoSource:onData drop frame in past for FFmpeg:" << (m_prevTimestamp-ts);

} else {
content.insert(content.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset - index.start_offset);
content.insert(content.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);
rtc::scoped_refptr<webrtc::EncodedImageBuffer> frame = webrtc::EncodedImageBuffer::Create(content.data(), content.size());
m_decoder.PostFrame(frame, ts, frameType);
}
Expand Down

0 comments on commit 1018b11

Please sign in to comment.