On Fri May 31 22:01:31 2024 +0000, Elizabeth Figura wrote:
2/6 is... not correct, and I would appreciate more explanation of the problem. If the AVI decoder is supposed to always output PTS but GStreamer doesn't give them to us, I'd think the right thing to do would be to calculate the PTS ourself by adding the last sample's PTS and duration. [Or modify GStreamer?] 6/6 doesn't seem right either. According to the bug report it's for a deadlock; what's the deadlock?
The 2/6 problem is that GStreamer doesn't give us any PTS for Cinepak videos. With decodebin_parser, the Cinepak decoder's GstVideoDecoder base class takes the DTS, and previous PTS, and fills in missing PTS; I couldn't decipher the exact formula, so I just picked something.
If PTS plus duration feels better to you, then so be it. For some reason, the first frame does have a PTS.
The 6/6 deadlock consists of the AVI decoder calling IMemInputPin_Receive, which, for some reason, calls into another thread that calls qc_Notify. It works in decodebin_parser seemingly by accident; that function doesn't take any PE-side locks, it just calls into Unix code directly (and Unix-side locks are, of course, not held while calling IMemInputPin), so I just mirrored that.
If you can think of a better solution, do tell. Release the lock before calling IMemInputPin, maybe? But the release is higher up the call stack, so there's no obvious way to do that. Release lock, call IMemInputPin, and re-acquire lock just so strmbase/pin.c can release it?