@@ -1686,12 +1686,32 @@ void decode_frame_h264(VCSession *vc, Tox *tox, uint8_t skip_video_flag, uint64_
16861686// -------- DEBUG:AUDIO/VIDEO DELAY/LATENCY --------
16871687// -------- DEBUG:AUDIO/VIDEO DELAY/LATENCY --------
16881688
1689- vc -> vcb (vc -> av , vc -> friend_number , frame -> width , frame -> height ,
1690- (const uint8_t * )frame -> data [0 ],
1691- (const uint8_t * )frame -> data [1 ],
1692- (const uint8_t * )frame -> data [2 ],
1693- frame -> linesize [0 ], frame -> linesize [1 ],
1694- frame -> linesize [2 ], vc -> vcb_user_data );
1689+ if (vc -> vcb_pts )
1690+ {
1691+ uint64_t pts_for_client = h_frame_record_timestamp ;
1692+ int32_t delta_check = (int32_t )(h_frame_record_timestamp - frame -> pkt_pts );
1693+ if ((delta_check >= 0 ) && (delta_check <= 100 ))
1694+ {
1695+ pts_for_client = frame -> pkt_pts ;
1696+ }
1697+
1698+ vc -> vcb_pts (vc -> av , vc -> friend_number , frame -> width , frame -> height ,
1699+ (const uint8_t * )frame -> data [0 ],
1700+ (const uint8_t * )frame -> data [1 ],
1701+ (const uint8_t * )frame -> data [2 ],
1702+ frame -> linesize [0 ], frame -> linesize [1 ],
1703+ frame -> linesize [2 ], vc -> vcb_pts_user_data ,
1704+ pts_for_client );
1705+ }
1706+ else
1707+ {
1708+ vc -> vcb (vc -> av , vc -> friend_number , frame -> width , frame -> height ,
1709+ (const uint8_t * )frame -> data [0 ],
1710+ (const uint8_t * )frame -> data [1 ],
1711+ (const uint8_t * )frame -> data [2 ],
1712+ frame -> linesize [0 ], frame -> linesize [1 ],
1713+ frame -> linesize [2 ], vc -> vcb_user_data );
1714+ }
16951715 }
16961716
16971717 // end_time_ms = current_time_monotonic(vc->av->toxav_mono_time);
0 commit comments