The attached patch increases MIN_TS_PACKETS_FOR_FRAME_DETECTOR to 100 and itroduces counting the number of actual video TS packets in cTsPayload in order to be able to record channels that sometimes need even more than 10 TS packets for detecting frame borders.
While the frame type can typically be detected by processing at most two video TS packets, there may be several TS packets from other PIDs between the first and second video TS packet. Previously cTsPayload counted all TS packets against MIN_TS_PACKETS_FOR_FRAME_DETECTOR, and that number was intentionally kept small in order to keep the actual data processing at a minimum. With this patch, MIN_TS_PACKETS_FOR_FRAME_DETECTOR will be set to a presumably very safe large value, which only has an impact on the ringbuffer and should not increase processing costs there. The new MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION now defines the number of actual video TS packets that will be processed. There are also WRN_... macros in remux.c, which control some debug messages in case the safety margin for these limits is exceeded. You can try setting these to lower values for experimenting.
Please try this patch and let me know if the warning is ever triggered with the given values (or, in case you're experimenting with reduced values, what were the highest values that still triggered warnings).
Klaus