Skip to content

Commit

Permalink
send sps even decoding fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Aug 20, 2023
1 parent f618b62 commit 1a88adc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions inc/livevideosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,11 @@ class LiveVideoSource : public VideoSourceWithDecoder, public T::Callback
if (!sps)
{
RTC_LOG(LS_ERROR) << "cannot parse sps";
res = -1;
m_decoder.postFormat(codec, 0, 0);
}
else
{
int fps = 25;
RTC_LOG(LS_INFO) << "LiveVideoSource:onData SPS set format " << sps->width << "x" << sps->height << " fps:" << fps;
RTC_LOG(LS_INFO) << "LiveVideoSource:onData SPS set format " << sps->width << "x" << sps->height;
m_decoder.postFormat(codec, sps->width, sps->height);
}
}
Expand Down Expand Up @@ -187,7 +186,17 @@ class LiveVideoSource : public VideoSourceWithDecoder, public T::Callback
RTC_LOG(LS_VERBOSE) << "LiveVideoSource:onData SPS";
m_cfg.insert(m_cfg.end(), buffer + index.start_offset, buffer + index.payload_size + index.payload_start_offset);

m_decoder.postFormat(codec, 0, 0);
absl::optional<webrtc::H265SpsParser::SpsState> sps = webrtc::H265SpsParser::ParseSps(buffer + index.payload_start_offset, index.payload_size);
if (!sps)
{
RTC_LOG(LS_ERROR) << "cannot parse sps";
m_decoder.postFormat(codec, 0, 0);
}
else
{
RTC_LOG(LS_INFO) << "LiveVideoSource:onData SPS set format " << sps->width << "x" << sps->height;
m_decoder.postFormat(codec, sps->width, sps->height);
}
}
else if (nalu_type == webrtc::H265::NaluType::kPps)
{
Expand Down

0 comments on commit 1a88adc

Please sign in to comment.