plexinc / plex-media-player

Next generation Plex Desktop/Embedded Client
GNU General Public License v2.0
1.16k stars 170 forks source link

RPi: swallowing autorepeated key events does not work reliably #567

Closed stigger closed 6 years ago

stigger commented 7 years ago

Disclaimer: I'm using Harmony Hub acting as a bluetooth keyboard, but most likely this applies to other input devices as well

I've noticed that during playback the key presses tend to "stuck" for a while and repeatedly invoke the same action over and over again. While investigating, I discovered that the code in https://github.com/plexinc/plex-media-player/blob/master/src/ui/EventFilter.cpp#L123 that's supposed to handle repeated events does not work for me.

I've added additional logging:

      QLOG_DEBUG() << "autorepeat: " << kevent->isAutoRepeat();
      QLOG_DEBUG() << "text: " << kevent->text();

And here are the results:

2017-05-21 01:12:22 [ DEBUG ] EventFilter.cpp @ 123 - autorepeat:  false
2017-05-21 01:12:22 [ DEBUG ] EventFilter.cpp @ 124 - text:  ""
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 152 - Input received: source: "Keyboard" keycode: "Left" : InputBase::InputkeyState(KeyDown)
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 221 - Emit input action: ("left")
2017-05-21 01:12:22 [ DEBUG ] EventFilter.cpp @ 123 - autorepeat:  false
2017-05-21 01:12:22 [ DEBUG ] EventFilter.cpp @ 124 - text:  ""
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 152 - Input received: source: "Keyboard" keycode: "Left" : InputBase::InputkeyState(KeyDown)
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 221 - Emit input action: ("left")
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 152 - Input received: source: "Keyboard" keycode: "Left" : InputBase::InputkeyState(KeyUp)
2017-05-21 01:12:22 [ DEBUG ] InputComponent.cpp @ 152 - Input received: source: "Keyboard" keycode: "Left" : InputBase::InputkeyState(KeyUp)

For now I've worked around the issue by removing the if (kevent->text().size()) check (introduced in 00c744b207bdd4d844349d4b7a5e7af527decae9), but not sure how to fix it properly.

/cc @wm4

magnuslsjoberg commented 7 years ago

Getting unwanted auto-repeats on FLIRC as well. Backed to 1.3.0 which solves the problem for me.

stigger commented 7 years ago

Additionally to removing if (kevent->text().size()) I also had to disable the timer-based autorepeat, because the KeyUp sometimes incorrectly delayed, which triggers the autorepeat and messes up everything if I pressed "left" or "right" during playback.

LongChair commented 7 years ago

I have just tried to reproduced that issue, but wasn't able to. I'm running 1.3.1.673 on a RPi3. I am running it vanilla. Anything you guys would have that could be specific and which could help triggering this issue ?

stigger commented 7 years ago

The issue very easily reproduces for me under the following conditions (also on RPi3):

At some point the last keypress will start autorepeating and will repeatedly jump to the end or the beginning of the video file.

LongChair commented 6 years ago

@stigger : are you still having this issue ?

stigger commented 6 years ago

Unfortunately, can't say. I've abandoned the idea to use RPi as a media player a long time ago and moved to Apple TV 4K.

But when I was using RPi, I had to run my own patched build with the workaround that I've described above.

LongChair commented 6 years ago

Ok, as i haven’t heard about such an issue from other users, will close it then :)