rtpsession: add support for buffer lists on the recv path
The send path in rtpsession processes the buffer list along the way, sharing info and stats between packets in the same list, because it assumes that all packets in a buffer list are from the same frame. However, in the receiving path packets can arrive in all sorts of arrangements: - different sources, - different frames (different timestamps), - different types (multiplexed RTP and RTCP, invalid RTP packets). so a more general approach should be used to correctly support buffer lists in the receive path. It turns out that it's simpler and more robust to process buffers individually inside the rtpsession element even if they come in a buffer list, and then reassemble a new buffer list when pushing the buffers downstream. This avoids complicating the existing code to make all functions buffer-list-aware with the risk of introducing regressions, To support buffer lists in the receive path and reduce the "push overhead" in the pipeline, a new private field named processed_list added to GstRtpSessionPrivate, it is set in the chain_list handler and used in the process_rtp callback; this is to achieve this following effect: - iterate over the incoming buffer list; - process the packets one by one; - add the valid ones to a new buffer list; - push the new buffer list downstream. The processed_list field is reset before pushing a buffer list to be on the safe side in case a single buffer was to be pushed by upstream at some later point. NOTE: The proposed modifications do not change the behavior of the send path. The process_rtp callback is called in rtpsource.c by the push_rtp callback (via source_push_rtp) only when the source is not internal. So even though push_rtp is also called in the send path, it won't end up using process_rtp in this case because the source would be internal in the send path. The reasoning from above may suggest a future refactoring: push_rtp might be split to better differentiate the send and receive path.
Showing with 69 additions and 4 deletions