Skip to content

Commit

Permalink
Fix CLPI for H.264 BFF (Bottom Field First) streams
Browse files Browse the repository at this point in the history
Fixes issue #700.
  • Loading branch information
jcdr428 committed Sep 25, 2023
1 parent 0d1dc90 commit 2d64394
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tsMuxer/h264StreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ H264StreamReader::H264StreamReader()
m_frameNum = 0;
m_lastMessageLen = -1;
m_forceLsbDiv = 0;
m_fieldFirst = 0;
prevPicOrderCntMsb = prevPicOrderCntLsb = 0;
m_iFramePtsOffset = 0;
m_isFirstFrame = true;
Expand Down Expand Up @@ -672,6 +673,8 @@ void H264StreamReader::additionalStreamCheck(uint8_t *buff, uint8_t *end)
int picOrder = calcPicOrder(slice);
if (slice.isIDR())
frameNum = -1;
if (slice.isIFrame())
m_fieldFirst = slice.bottom_field_flag;
checkPyramid(++frameNum, &picOrder, true);
}
break;
Expand Down Expand Up @@ -1079,7 +1082,7 @@ int H264StreamReader::processSliceNal(uint8_t *buff)
if (slice.first_mb_in_slice != 0)
return 0;

if (slice.bottom_field_flag == 1) // insrease PTS/DTS only for whole frame
if (m_fieldFirst != slice.bottom_field_flag) // insrease PTS/DTS only for whole frame
return 0;

if (detectPrimaryPicType(slice, buff) != 0)
Expand Down
1 change: 1 addition & 0 deletions tsMuxer/h264StreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class H264StreamReader final : public MPEGStreamReader
int prevPicOrderCntMsb;
int prevPicOrderCntLsb;
int m_forceLsbDiv;
int m_fieldFirst;
int m_lastMessageLen;
bool m_isFirstFrame;
SeiMethod m_insertSEIMethod;
Expand Down

0 comments on commit 2d64394

Please sign in to comment.