Java format detection can reject native result sometimes
- Dominant language
- Java
- Stars
- 287
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
I have an example stream where the PAT is valid but the PMT is not (similar to one we fixed recently). When I import this file into SageTV, it will fail on the native detection and revert to FFMPEG instead. This file was a cablecard recording from FiOS.
SageTV won't play recordings while they are active if the native format detection fails. It will allow usage of FFMPEG after the recording completes....so this problem can manifest itself badly if trying to watch something live.
What happens in the sage.media.format.FormatParser.extractMyFormat(String, File) is that it looks at the 'Ret' value from the native layer and it ends up being -1 here, which causes it to abandon further processing since it is negative. When there's a total failure at the native layer, it returns -2 in this case.
So we could change this code to accept the -1 Ret value and then let the Java layer parse the format information and it would work fine for this test case. I am however concerned that this could cause it to return format detection results too early. Such as when it hits a stream where it finds no PAT/PMT because they haven't arrived yet and would then just use the other PIDs it found for the valid streams....that's the whole reason we reject using FFMPEG for live TV format detection and prefer to use our own code.
I just wanted to log this issue so if this comes up again we know where to fix it at.
Contributor guide
Assessment
This issue has not been assessed yet.