OneLiberty / moonlight-chrome-tizen

A WASM port of Moonlight for Samsung Smart TV's running Tizen OS (5.5 and up)
GNU General Public License v3.0
185 stars 15 forks source link

Fix the video codec negociation #36

Closed henryfa2 closed 4 months ago

henryfa2 commented 4 months ago

Fix the video codec negociation between the server and Moonlight : If Moonlight is set to a video codec not supported by the server, it is now going to choose the best video codec available on the server (AV1 then HEVC then H264) instead of defaulting to H264.

fixes #35

OneLiberty commented 4 months ago

Sorry i didn't see that earlier.

I do have one question regarding this. What happen if HEVC is not available on the host ? does it fall back on H264 ?

If not, wouldn't it be better to fallback on H264 which is more widedly supported ?

Also, this make me think about an "auto" option, which would select the best available codec based on what's supported by the host.

henryfa2 commented 4 months ago

Sorry i didn't see that earlier.

I do have one question regarding this. What happen if HEVC is not available on the host ? does it fall back on H264 ?

If not, wouldn't it be better to fallback on H264 which is more widedly supported ?

Also, this make me think about an "auto" option, which would select the best available codec based on what's supported by the host.

Basically, the video codec negociation checks if the server and Moonlight both supports the video codecs. With this fix, if I choose AV1, the algorithm is :

  1. If AV1 available on server, then codec = AV1
  2. If AV1 not available and HEVC available, then codec = HEVC
  3. If AV1 not available and HEVC not available, then codec = H264 Previously, without the fix, we would select H264 instead of HEVC if HEVC was available on server.

About the auto option, I don't know if we can automatically get the video codecs supported by the TV.

OneLiberty commented 4 months ago

So i did try the fix this morning. On my end, it doesn't seems to fallback to another supported codec.

For exemple, setting the stream with AV1 (which is not supported on my local PC) result in a blackscreen followed by a connection terminated.

As i understand, this setup should fallback to HEVC (which is supported by my host), but it does not :/ Anything i'm doing wrong ?