Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vero 4K support #573

Open
TheHacker66 opened this issue Oct 7, 2017 · 129 comments
Open

Vero 4K support #573

TheHacker66 opened this issue Oct 7, 2017 · 129 comments

Comments

@TheHacker66
Copy link

TheHacker66 commented Oct 7, 2017

NVidia Geforce Experience version: 3.9.0.97
Moonlight Embedded version: 2.4.3
Moonlight Embedded source: compiled from source
Moonlight Embedded running on: Vero 4K
Moonlight Embedded running on distribution: OSMC

Verbose output -verbose of Moonlight Embedded:

Searching for server...
Connect to 192.168.178.20...
No mapping available for meson-ir (19000000000000000000000000000000) on /dev/input/event2
No mapping available for gpio_keypad (10000000010000000100000000010000) on /dev/input/event0
No mapping available for cec_input (100000008e1b0000ec0c000001000000) on /dev/input/event1
Initializing platform...done
Resolving host name...done
Starting RTSP handshake...done
Initializing control stream...done
Initializing video stream...done
Initializing audio stream...done
Initializing input stream...done
Starting control stream...done
OPEN es DEVICE
codec_init amstream version : 2.0
[codec_init 732]type =1
[codec_init 740]
Starting video stream...done
ALSA lib pcm_direct.c:896:(snd1_pcm_direct_initialize_slave) slave plugin does not support mmap interleaved or mmap noninterleaved access
ALSA lib pcm_dmix.c:1034:(snd_pcm_dmix_open) unable to initialize slave
Starting audio stream...Alsa error code -22
Audio stream start failed: -1
Stopping video stream...ENet wait interrupted
Control stream connection failed
Loss Stats: Transaction failed: 11
[codec_close 851]
[codec_close_cntl]video codec close return=0!
done
Stopping control stream...done
Cleaning up input stream...done
Cleaning up audio stream...done
Cleaning up video stream...done
Cleaning up control stream...done
Cleaning up platform...done
EVIOCGRAB failed with error 16
EVIOCGRAB failed with error 16

I have forked the repo and made the necessary changes for moonlight to compile. AMLogic support is already included in the Vero 4K.

Is someone willing to check what might be wrong? Thanks

@TheHacker66
Copy link
Author

I'm bumping this and adding more logs:

https://gist.github.com/antsu/b426d72a35e7b32fbad64f05552225ba

Hope that someone will look into this sooner or later ;)

@cgutman
Copy link
Member

cgutman commented Nov 20, 2017

Can you try specifying the target audio device manually?

If that fails, try building with PulseAudio to see if the PA backend works.

@TheHacker66
Copy link
Author

TheHacker66 commented Nov 20, 2017

Hi @cgutman!

Thanks for the suggestions, specifying the audio works (kinda), i can hear crackling sounds coming from the tv but the video is still black.

Something interesting coming from the verbose output:

[codec_init 732]type =1
[codec_init 740]
Starting video stream...done
Starting audio stream...done
Starting input stream...done
EVIOCGRAB failed with error 16
EVIOCGRAB failed with error 16
Alsa error from writei: -32
Returning RTP packet queued for too long
Received OOS audio data (expected 28132, but got 28133)Waiting for IDR frame
Alsa shortm write, write 48 frames
Alsa shortm write, write 64 frames
Alsa shortm write, write 192 frames
Alsa shortm write, write 64 frames
Alsa error from writei: -32
Unrecoverable frame 197: 16+2=18 received < 21 needed
Network dropped an entire frame
codec_write error: ffffffff
[codec_close 851]
[codec_close_cntl]video codec close return=0!
OPEN es DEVICE
[codec_init 732]type =1
[codec_init 740]
[codec_reset:1199]ret=0
Requesting IDR frame on behalf of DR
Waiting for IDR frame
Waiting for IDR frame
Alsa error from writei: -32
...

Hope this gives some clues!

@cgutman
Copy link
Member

cgutman commented Dec 6, 2017

What exact parameters are you passing to stream? What GPU is in your PC?

You might try adding -codec h264. I found that some Amlogic chips don't like the default h.265 stream that GeForce Experience produces.

I implemented a workaround in moonlight-common-c for the most recent GFE version, which supports specifying the number of reference frames. moonlight-stream/moonlight-common-c@f6ae7fc

@TheHacker66
Copy link
Author

TheHacker66 commented Dec 6, 2017

The last time I simply ran moonlight stream -audio hw:0,0 -platform aml. I have a GTX 770.

I merged the recent commits, I'll compile, test using your suggestions and report back tonight. Thanks!

@TheHacker66
Copy link
Author

Unfortunately specifying the h264 codec didn't change much, i got less errors in console but the screen is still black.

@TheHacker66
Copy link
Author

OSMC and Vero 4k were updated to Stretch. Unfortunately the black screen issue still remains.

@samnazarko
Copy link

Can you try run strace and see if it gives us anything useful?

@TheHacker66
Copy link
Author

Yup, here's the log: https://paste.osmc.tv/isavozohoz

@danielfmo
Copy link

Hello,

I belibe this is a kodi and amlogic problem and not with moonlight.

Please take a look here:
https://forum.odroid.com/viewtopic.php?f=91&t=15456&p=171714&hilit=%2Fsys%2Fclass%2Fvideo%2Fdisable_video#p171714

try to set /sys/class/video/disable_video to 0 before starting moonlight

@samnazarko
Copy link

Good find @danielfmo . Let us know how it goes @TheHacker66 .
I can patch Kodi to reset this on exit; or you can set it in a startup script in Moonlight.

@TheHacker66
Copy link
Author

Well guys, unfortunately setting that flag before running moonlight didn't change anything. I can run another strace with the flag set to 0 if needed.

So close yet so far..

@samnazarko
Copy link

@TheHacker66 I've sent you a PM with a kernel with amlvideo debugging on. It may give us some clues if the decoder isn't happy.

@TheHacker66
Copy link
Author

I won't be at home till Saturday, so I'll test it once I get back.

@samnazarko
Copy link

samnazarko commented Feb 14, 2018 via email

@TheHacker66
Copy link
Author

Hi, sorry for not replying earlier.

I installed the kernel and rebooted. Unfortunately there seems to be an incompatibility with the latest GFE version because moonlight complains about an udp port which is open in the firewall and that was working before. The version I have installed is 3.12.0.84

I tried uninstalling that and installing the version available on nvidia's site (3.12.0.79) to no avail. Deleting firewall rules (that were recreated after the install) didn't change anything.

I'll try to reinstall a even older version to see if the problem goes away.

@TheHacker66
Copy link
Author

TheHacker66 commented Feb 21, 2018

Ok, I reinstalled the version I had when I started this thread (3.9.0.97) and moonlight started working again.

Sorry, I forgot to run the modprobe command..

Here's the correct log:

https://paste.osmc.tv/monaxowoyo

I checked the disable_video flag and it was set to 2, is it normal?

EDIT:
I don't see anything wrong in this new log, but I saw some errors in the previous log, so I'll leave it here:
https://paste.osmc.tv/ezeludacig

@samnazarko
Copy link

Hopefully you're feeling better now.

Thanks for giving this a go.

[ +0.010327] codec:vdec1 video changed to 0 x 0 0 fps clk->200MHZ

I think this is the problem. The video decoder doesn't seem to be set up correctly.

I believe Moonlight uses libamcodec. Can you confirm if you compiled Moonlight using the libamcodec-dev-osmc package?

@TheHacker66
Copy link
Author

TheHacker66 commented Feb 22, 2018

Hi Sam, thanks.

I have indeed installed vero3-libamcodec-dev-osmc. I modified the cmake/FindAmlogic.cmake file to point to /usr/osmc/lib/ where libamcodec.so is located.

It is correct?

EDIT: That line you mentioned is right at the end just before i stopped the stream via Steam, so I think it's right. There's another one which seems correct:

[ +0.000048] codec:vdec1 video changed to 3840 x 2160 60 fps clk->667MHZ

@TheHacker66
Copy link
Author

TheHacker66 commented Feb 22, 2018

Here's the output from moonlight from today's test @ 1920x1080:

http://paste.osmc.tv/poqayipobo.vbs

And the dmesg:

https://paste.osmc.tv/azezuderow

@samnazarko
Copy link

Yes -- that's one way to get the compile to use the OSMC versions of libamcodec.

[ +0.007596] codec:vdec1 video changed to 0 x 0 0 fps clk->200MHZ

This still looks to be the problem. I'm not sure why the decoder is not getting hints properly; but I suspect something in Moonlight isn't setting up the amprivate structs properly.

@samnazarko
Copy link

@cgutman @danielfmo might have some more ideas.

I'll see if I can get access to an NVIDIA system to test this out with.

@TheHacker66
Copy link
Author

You should still have remote access to my Vero 4k to fiddle with. I won't be at home tomorrow but I will be this weekend if you need me for tests.

@williamluke4
Copy link

@TheHacker66 Have you had any luck?

@TheHacker66
Copy link
Author

Nope. I think we need @cgutman or @irtimmer help.

@samnazarko
Copy link

We're happy to get hardware out to resolve this.

@maxanier
Copy link

Currently considering buying a Vero 4k, but I would like to also use moonlight on it. So I was wondering if you had any success in the meantime? Thank you

@samnazarko
Copy link

Nothing yet unfortunately.
I can't think of anything we have significantly diverged with that would cause such issues.

I'm happy to ship hardware to any developers. In the interim, I'm going to see if I can set up an NVIDIA system to look in to this myself. I am away for a few weeks however.

@ZacWolf
Copy link

ZacWolf commented Jul 23, 2018

Anything on this yet?

@samnazarko
Copy link

Unfortunately nothing has moved this forward yet.

@samnazarko
Copy link

samnazarko commented Apr 18, 2023 via email

@EvgeniySpinov
Copy link

EvgeniySpinov commented Apr 19, 2023

Ok, seems like I've found 1 more issue:

  • Sunshine 0.18.4, with NEVC enforced
  • Moonlight from master, set to h264 codec

Unable to start streaming:
Logs from client (debug): https://paste.osmc.tv/sidasowupi
Logs from server (debug): https://paste.osmc.tv/ozamefumih.hs

Changing client codec to h265 or auto works without issues. I assume the issue is with those lines on Vero 4K+:

set_decoder_config
codec_h_ioctl_set failed,handle=25,cmd=111,paramter=0, t=ffffffff errno=19
codec_h_ioctl failed,handle=25,cmd=401053c2,subcmd=111, paramter=0, t=ffffffff errno=19
codec_init error: fefffff6
Starting video stream...Video stream start failed: -2
Stopping control stream...ENet peer acknowledged disconnection
done

i.e. seems that something wrong with codec setup on Vero 4K side, as stream is not even starting from server perspective.

Config on the client side:

[Moonlight]
width = 3840
height = 2160
fps = 60
bitrate = 80000
packetsize = 1392
sops = false
remote = auto
localaudio = false
debug = true
audio = sysdefault
codec = h264
nounsupported = false
nomouseemulation = false

UPD: Looks like issue is with resolution higher than 1080p. With 1080p h.264 works fine. Likely codec initialization fails on those lines:

if (width > 1920 || height > 1080) {
codecParam.video_type = VFORMAT_H264_4K2K;
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264_4K2K;
} else {

According to xbmc/xbmc#10944 some devices (like with Amlogic S905X) should use VFORMAT_H264 codec for 4K streams, instead of VFORMAT_H264_4K2K.

I'll prepare PR.

@EvgeniySpinov
Copy link

Short update on H264 decoding:

  • Applying changes mentioned above from XBMC thread, I'm able to get video stream on Vero 4K+
  • But it instantly starts to get increased latency with arythmetical progression and in around 10 seconds freezes completely. No errors in console (starting in debug mode, but probably there is some more). Something similar to what is described in this post: Vero 4K support #573 (comment)
  • This seems like an issue with decoder pipeline setup or decoder settings, which is discussed above. However, I do not have enough knowledge to tackle this. Issue observed also with 1080p.

If anyone can help with this - would be great.

@TheHacker66
Copy link
Author

Hi, I'm resuming the thread because I tried compiling from source but I still cannot see the video.

I assumed all the needed fixes were merged in master?

@antoyo
Copy link

antoyo commented Jan 24, 2024

Any update on this?

I also tried compiling from source and I cannot see the video.

I tried echo 0 > /sys/class/video/disable_video, but it didn't help.

I'm on the Vero V.

@cgutman
Copy link
Member

cgutman commented Feb 18, 2024

@samnazarko anything special we need for Vero V?

#884 logs see to show the codec is not consuming input quickly (at all?) - lots of codec_write() timeout

@samnazarko
Copy link

What codec is being used?
Can we try an alternative (H264 vs HEVC)?

@antoyo
Copy link

antoyo commented Feb 19, 2024

I tried h264, h265 and av1. Same issue for all.

@samnazarko
Copy link

OK, thanks for the feedback.

@antoyo
Copy link

antoyo commented Apr 5, 2024

I made some tiny bit of progress.
By running these commands first, I see the first frame of the stream, then it goes black:

echo rm default > /sys/class/vfm/map
echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map

Hope this helps.

@antoyo
Copy link

antoyo commented Apr 20, 2024

@cgutman: I continued my investigation and it seems you stumbled on both of these issues in the past that I'm currently facing.

The first one is that I only see the first frame (similar to what happened to you in this comment).
I added calls to codec_get_vdec_state like you did and I got logs like these:

[…]
Error: 0, status: 1 | 0x0x60
Error: 0, status: 1 | 0x0x60
Error: 0, status: 53 | 1280x720x60
Error: 0, status: 53 | 1280x720x60
Error: 0, status: 53 | 1280x720x60
Error: 0, status: 53 | 1280x720x60
Error: 0, status: 53 | 1280x720x60
Error: 0, status: 5 | 1280x720x60
[…]

I don't know what those statuses mean, but I only see those (1, 5 and 53) in this case.

Also, when using h264, I got the same issue that you got in this comment. Here's what I see in dmesg:

[Sat Apr 20 11:31:07 2024] 0: frame number gap error
[Sat Apr 20 11:31:08 2024] 0: frame number gap error
[Sat Apr 20 11:31:08 2024] 0: frame number gap error
[…]

This time, codec_get_vdec_state shows different statuses (6 and 22) and the error count starts increasing at some point:

[…]
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 0, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 1, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 2, status: 6 | 1280x720x60
Error: 3, status: 6 | 1280x720x60
Error: 3, status: 6 | 1280x720x60
Error: 3, status: 6 | 1280x720x60
[…]

I have a few questions for you:

  • How did you fix these issues (only first frame shown, "frame number gap error")?
  • What is the meaning of those status code?

Thanks for your help!

@antoyo
Copy link

antoyo commented May 10, 2024

Ok, I was finally able to stream some video!

I had to remove this line in src/platform.c:

write_bool("/sys/class/graphics/fb1/blank", true);

In order to write a proper patch, I would need to know why this was added back in c2036ac#diff-95d130942a7b36a52939da0fea295a6587be8b1249c5b7d2ac9e7018b77f561bR81.
Do you know if it would be OK to completely remove this line?
Or would I need to add a condition to only do this on the Vero V?

Thanks for your help.

@maxanier
Copy link

maxanier commented Jun 28, 2024

Hey everyone. Thank you very much. After a few years, I tried again to stream games to the Vero4k in 4k resolution and it works great now :)

Versions: Moonlight Embedded v2.7.0 (self built
Sunshine: 0.23.1
OSMC: Linux vero 4.9.269-56-osmc
Moonlight setup/pairing as usual.

I had to manually preload the aml.so for some reason. Also I have to manually set the output resolution.
My start script:

sudo systemctl stop mediacenter
echo 2160p60hz > /sys/class/display/mode
LD_PRELOAD=/home/osmc/moonlight/build/libmoonlight-aml.so  moonlight stream -app Heroic -4k -verbose -platform aml -bitrate=100000
sudo systemctl start mediacenter

@Diaoul
Copy link

Diaoul commented Jun 28, 2024

@maxanier curious where do you put this start script?
Any chance to avoid the stop/start of the mediacenter and make this a separate unit that mediacenter depends on?

@maxanier
Copy link

maxanier commented Jun 28, 2024

I just put it in the home folder.
When I want to play, I have to connect via SSH and start the script.
Not ideal, but works for now. I have to start sunshine on my PC anyway.

I am stopping Kodi before streaming because I experienced lag/stuttering/issues when Kodi is running in the background.
The start command is just there so it automatically relaunches Kodi for convenience after moonlight has finished (so only after streaming has stopped).

@TheHacker66
Copy link
Author

TheHacker66 commented Jun 28, 2024 via email

@agboom
Copy link

agboom commented Aug 8, 2024

Hi, I'm also tinkering with my Vero V to get Moonlight to work. Thanks to this thread I was able to get it working by removing the line mentioned in #573 (comment) and building moonlight-embedded myself.

Moonlight Embedded 274d3db (self built)
Sunshine: 0.23.1
OSMC: Linux vero 4.9.269-64-osmc
GPU: AMD Radeon RX 6700 XT

I'm still struggling with the optimal settings though. Setting -bitrate 200000 cause a lot of log lines like Unrecoverable frame 3002 (block 2 of 3): 79+10=89 received < 120 needed and stuttering. I went all the way down to 75000 to reduce the stutters, but then had noticable lag. Not sure if those two are related.

I found a recommendation to enable performance stats with Ctrl+Alt+Shift+S, but apparently this doesn't work in moonlight-embedded (someone mentioned this in Discord). This makes it a bit more challenging to find the optimal settings. Otherwise this looks promising!

@agboom
Copy link

agboom commented Aug 25, 2024

I continued testing Moonlight with my Vero V and it works fine, except when a black screen happens. This is resolved by rebooting the Vero. At first this seemed random, but then I noticed a pattern that every time I watched a video on OSMC, the black screen happened again. Maybe the video player does something with the frame buffer that stops Moonlight from being able to use it?

I was able to capture the logs for both situations. There are some noticable differences, but I'm afraid I'm not knowledgable to make any sense of it.

With video:

Without video:

@antoyo
Copy link

antoyo commented Aug 26, 2024

I noticed as well that playing a video in OSMC changes some settings.

This might help you: I run moonlight-embedded from Luna (I believe I use this add-on) and I modified the prescript.sh to the following:

echo 1 > /sys/class/graphics/fb0/blank
echo "rm default" > /sys/class/vfm/map
echo add default decoder ppmgr deinterlace amlvideo amvideo > /sys/class/vfm/map

Perhaps you need to run some of these commands before running moonlight.

Edit: @agboom: I saw you made a PR to Luna. If you want, I could send you the changes I made to Luna: I didn't make a PR because I figured I spent enough time to make this working.

@agboom
Copy link

agboom commented Aug 26, 2024

Hi @antoyo, thanks for replying! Indeed, I use Luna as well and shared some possible improvements. Thanks for your suggestion, I'll try it as soon as I have the time.

If you have more changes you want to share, I'm certainly interested. It would be nice to have a plug-and-play experience with Moonlight for Kodi/Vero and Luna seems like the way to go right now. I have some more ideas for the long term, like app shortcuts in the main menu and automatic wake-on-lan.

@agboom
Copy link

agboom commented Aug 27, 2024

@antoyo Your solution works, thanks! Interestingly, the first line looks like it does the same as the (removed) line from src/platform.c:

write_bool("/sys/class/graphics/fb1/blank", true);

Do the commands after resolve something maybe? The vfm map seems to be accessible from MBE so maybe we can add these lines to src/video/aml.c or something? I'll try this later.

One issue solved, another pops up 🙈:
The video seems to be increasingly delayed. In one session - after 30 minutes - the delay was about 2 seconds (timed from control press to video feedback). It doesn't seem input lag, because the audio feedback is almost instant. A new session resets the delay, but it's reproducible.

I have a moonlight log from the session the delay occurs: https://paste.osmc.tv/elogetokay.coffee

@antoyo
Copy link

antoyo commented Aug 27, 2024

@antoyo Your solution works, thanks! Interestingly, the first line looks like it does the same as the (removed) line from src/platform.c:

write_bool("/sys/class/graphics/fb1/blank", true);

This is setting fb1 while the command in the script sets fb0. I guess it might work to change moonlight-embedded to use fb0, I don't know.

One issue solved, another pops up 🙈: The video seems to be increasingly delayed. In one session - after 30 minutes - the delay was about 2 seconds (timed from control press to video feedback). It doesn't seem input lag, because the audio feedback is almost instant. A new session resets the delay, but it's reproducible.

I have a moonlight log from the session the delay occurs: https://paste.osmc.tv/elogetokay.coffee

Is this caused by the commands I posted? I believe you'll find other people that had delays in this thread: perhaps they also posted the solution?
I also remember having delay at some point: I don't remember exactly how I fixed it (perhaps it was fixed by changing the codec), but here's my moonlight config in case it helps:

[Moonlight]
address = myhostname
width = 1920
height = 1080
fps = 30
bitrate = 20000
packetsize = 1392
sops = false
remote = auto
localaudio = false
debug = false
audio = sysdefault
codec = h265
nounsupported = false
nomouseemulation = true

@agboom
Copy link

agboom commented Aug 27, 2024

This is setting fb1 while the command in the script sets fb0. I guess it might work to change moonlight-embedded to use fb0, I don't know.

Ah, good point, I missed that.

Is this caused by the commands I posted? I believe you'll find other people that had delays in this thread: perhaps they also posted the solution?

You're right, this has been mentioned before. I have fps at 60, so that probably causes the delays. I should read the comments in here more closely 😅

@zjoasan
Copy link

zjoasan commented Sep 2, 2024

From TheHacker666:

static int framecount = 0;
If (++framecount % 60 == 0) {
return DR_NEED_IDR;
}

We put this together, since I had the same problem, but on steroids, 30 secs streaming,15 sec frozen video with streaming audio. Just then then rinse and repeat. the issue was that for each "blackout", they became longer and longer. With the help of another dev. at OSMC. We xperimented with clearing the buffer at intervals..

Why I probably had it worse then most, is my old desktop, Just Intel HD4600, first gen with some sort of quicksync. I'm guessing it's giving of a much "dirtier" streamthen modern nVidia does. Due to having a harder time keeping up with the system.

The thought was force "clearing" Veros buffer, in order to reduce the build-up causing lag. Tjhe "modula 60" was to have it as a starting point. I was going to experiment with it, but I've gotten tied up in other projects. So, as long as you modulate is evenly dividable by the frame rate, it "should be good".

Hope this helps someone.
/Joakimn

@agboom
Copy link

agboom commented Sep 8, 2024

@zjoasan Thanks for your suggestion. I managed to add this patch. Sadly for me it doesn't help with the increasing latency. I probably need to find the right modulo value. I set it to 60 while keeping the fps at 60 too.

Another side effect of this patch is that there's some kind of artifact pulsing about every second. If I change the modulo to 10 it pulsates faster (looks like about 6 per second), but the latency still increases over time.

I tried to record a video of it, I hope this gives an idea:

vid.mp4

@agboom
Copy link

agboom commented Sep 8, 2024

After removing the framecount patch I fiddled a bit more with the Moonlight settings:

  • 1080p / 60fps / 20mbps: results in increasing video latency fairly quickly (5 minutes)
  • 1080p / 60fps / 10mbps: same
  • 1080p / 30fps / 10mbps: does not give noticeable latency
  • 1080p / 30fps / 20mbps: no latency as well

The behavior seems to be the same as described here: #662

@cgutman
Copy link
Member

cgutman commented Sep 9, 2024

This is completely unrelated to #662. In the case of #662, the Pi 2 was not rated for 1080p60, so it could not keep up without overclocking. The issue here is the same accumulation of frames due to mismatching between the rate of display and the rate of incoming frames problem I reported a long time ago: #573 (comment)

We're reporting PTS values for every frame we submit, so I don't know what else we're supposed to do. We need some way of asking for overdue frames in the pipeline to be dropped or to at least limit the number of buffered frames. I'm not sure if there's a way to do that.

TBH though, I think the answer is for the Amlogic software stack to leave this poorly-documented vendor-specific API and ancient kernel version in the past and start supporting standard V4L2, so you can use a modern client like moonlight-qt. Moonlight-Embedded is a legacy client from the dark ages of the 2010s when every SoC vendor invented their own bespoke video decoding and rendering APIs. Fortunately we're (mostly) past that era, and Moonlight-Qt's embedded packages already work great using standard V4L2+DRM+GL APIs on plenty of platforms like RK3288, RK3399, JH-7110, BCM2711, BCM2712, and probably more.

@zjoasan
Copy link

zjoasan commented Sep 9, 2024

I totally agree with @cgutman , there are better solutions, but as we are tied to this platform for now. I'm still trying to get it as good as it can get. With my old hardware, a modulo of 20 eliminate build up, at least for 20-ish minutes (60 fps). There is side effects, but hard to describe.

Thanks for the info about PTS, will take it back to OSMC-devs and see if we can come up with more elegant solution.

@agboom
Copy link

agboom commented Sep 9, 2024

I agree, I didn't mean to imply that the issue was related, just that the behavior was the same. But yeah, RPI is a completely different thing.

Having a working moonlight-qt would be awesome. I did try it out, but got no further than the main screen, no streaming. That makes sense now based on what you explained. I gathered at some point it had something to do with DRM and KMS, or lack thereof, and a newer kernel version would help, but my knowledge is very limited in that area. It's also out of scope of this issue, so I'll stop talking about it here. I have a thread over at OSMC Discourse about Moonlight dependencies if you'd like to weigh in, I certainly would like to learn!

Anyway, regarding MBE, I've settled on 30fps for daily use. I'll try some more modulo values later. If I can help by testing anything, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests