On Fri Sep 6 04:47:54 2024 +0000, Ziqing Hui wrote:
OK, I think I find out the reason why preferred_format is different from what the actual output format. We are calling wg_parser_stream_enable() in init_stream() to set our desired output format. And wg_parser_stream_enable() will send a reconfigure event to upstream, and we expect upstream element send a GST_EVENT_CAPS event downstream to my_sink pad, and we only set preferred_format to the actual output format when we are handling GST_EVENT_CAPS in sink_event_cb(). The problem is, the GST_EVENT_CAPS is not synced with wg_parser_stream_enable(). If we try to use preferred_format after wg_parser_stream_enable() and before GST_EVENT_CAPS, it will be wrong format. The issue of the game I mentioned above is because it calls stream_props_GetMediaType() after parser created, but before CAPS event. So using preferred_format here will result in a wrong result. And this is a common usage, there is high possibility that we want to know the output format in front side after we creating the reader.
Ah, right, this is what I was alluding to with 5667. The preferred_format *should* be only set when we first get it; it's a bug that it's not.