EVR playback requires RuntimeLib registry value, fails for local JRE installs
- Dominant language
- Java
- Stars
- 287
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
Because it is apparently more appealing/less work(?) than signing up for whatever account Oracle requires to download the latest Java 8, I am trying to see if I can get alternative OpenJDK-based distributions (such as [AdoptOpenJDK](https://adoptopenjdk.net/) and [Zulu](https://www.azul.com/downloads/zulu/)) to work with 32-bit SageTV Client v9.2.1 for Windows. Since a .zip distribution doesn't create the registry keys and environment variables for other applications to find the Java Runtime Environment, I found that [SageTV also looks for a `jre\bin\client\jvm.dll` file in its own directory](https://github.com/google/sagetv/blob/87b4e7e4d821f6f9f0955ef7003dbb3b5d746e71/native/exe/SageLauncher/launcher.cpp#L925).
The Client loads OK with a local JRE, however with `Setup → Detailed Setup → Video / Audio → Video Renderer` set to `EVR` either the audio plays with a black screen and something like the following is [written to the log](https://github.com/google/sagetv/blob/87b4e7e4d821f6f9f0955ef7003dbb3b5d746e71/native/dll/DShowPlayer-2/PlaybackGraph.cpp#L417)...
[AWT-EventQueue-0@19bb367] Creating GraphPluginHandler...
[AWT-EventQueue-0@19bb367] Done creating GraphPluginHandler
[AWT-EventQueue-0@19bb367] Detected default audio stream index to be: 1
[AWT-EventQueue-0@19bb367] DShowPlayer setVideoRendererFilter0({FA10746C-9B63-4B6C-BC49-FC300EA5F256}) called
[AWT-EventQueue-0@19bb367] Using EVR for video render
[AWT-EventQueue-0@19bb367] WIN32 FAILURE HR=0x80004005 FILE=PlaybackGraph.cpp LINE=417
[AWT-EventQueue-0@19bb367] Could not add specified video rendering filter to graph hr=0x80004005
[AWT-EventQueue-0@19bb367] DShowPlayer setVideoDecoderFilter0(LAV Video Decoder) called
...or SageTV immediately terminates with `Using EVR for video render` being the last such line in the log.
With some experimentation I found that not only does EVR work if Java is located through an `HKEY_LOCAL_MACHINE\SOFTWARE\(WOW6432Node\)JavaSoft\Java Runtime Environment\x.y\RuntimeLib` registry value (regardless of it being a local or global JRE), but that once the Client is running the presence of that value is what really determines if EVR playback works or not. That is, I can "break" EVR by renaming it to, say, `RuntimeLib.disabled` and (if it didn't crash) it works again after renaming it back.
A quick search of the source for `RuntimeLib` led me to [what I believe is the culprit](https://github.com/google/sagetv/blob/87b4e7e4d821f6f9f0955ef7003dbb3b5d746e71/third_party/Microsoft/EVRPresenter/PresentEngine.cpp#L64), where I see that only the path in the registry, and not the presence of a local `jre\bin\client` directory, is considered when attempting to load `jvm.dll`. I am not sure if checking for that local directory first, like the launcher does, is sufficient to address this.
For reference, [Cannot upgrade to SageTV 9](https://forums.sagetv.com/forums/showthread.php?t=63853) on the forums is a related issue as far as a `RuntimeLib` path and a `jre` directory both existing but not being the same directory/version.
Contributor guide
Assessment
This issue has not been assessed yet.