On Tue Mar 12 13:33:27 2024 +0000, Alfred Agrell wrote:
If the mismatch is just compressed/uncompressed, then that's supposed to happen. If they are indeed switching audio/video, then yes, they probably got rearranged, and that does indeed sound like a bug. I didn't run into any such trouble during my testing, but that may just have been my testing being limited. I never checked how those Unix-side streams are created, so I'm not sure how that part should be solved. One solution would be to check the streams' media types, compare to the expected type, and swap if mismatched, but I don't know if it's the best answer; there may be a better solution somewhere deeper inside winegstreamer.
I spotted the problem. In `init_stream`:
```c stream->wg_stream = wg_parser_get_stream(reader->wg_parser, reader->stream_count - i - 1); ```
vs `reinit_stream`:
```c stream->wg_stream = wg_parser_get_stream(reader->wg_parser, i); ```
Though indeed the order of the streams is not guaranteed to stay the same (as per @rbernon)