I found a code block in /modules/stream_out/transcode/video.c that I'm trying to understand. The code exists in the transcode_video_process function. My understanding of the below code is that in the unlikely event that video has drifted 50ms, don't send the picture, or in the unlikely case that the video is 50ms too early, send a duplicate. My observation is that the conditional which causes duplicates to be sent, causes a number of problems. When this occurs, a spurt of duplicates are sent for a number of seconds or more. This causes the bitrate to increase significantly. We also packetize for HLS, and this seems to break streaming to the latest generation of apple devices. If I comment out the conditional which sets the duplicate flag, bitrate is correct, and streaming works on the latest generation of apple devices. Can someone better explain the conditional below? What is the purpose of the duplicate flag?
Code: Select all
if( unlikely( i_video_drift < (i_master_drift - 50000) ) )
{
#if 0
msg_Dbg( p_stream, "dropping frame (%i)",
(int)(i_video_drift - i_master_drift) );
#endif
picture_Release( p_pic );
continue;
}
else if( unlikely( i_video_drift > (i_master_drift + 50000) ) )
{
#if 0
msg_Dbg( p_stream, "adding frame (%i)",
(int)(i_video_drift - i_master_drift) );
#endif
b_need_duplicate = true;
}