Author Topic: A Couple Of Issues  (Read 15237 times)

Multiplexer

  • Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
A Couple Of Issues
« on: December 29, 2016, 11:54:20 PM »
Hi,

I appear to be having a couple of issues. The first is an intermittent controller problem using a dual shock 2 (Using rockfire usb) and dual shock 4 controller over bluetooth or usb.
Sometimes they work perfectly fine, other times RetroFE seems to buffer the buttons that are pressed, for example you could press the up button 10 times and nothing will happen, 20 seconds later all 10 presses will happen all at the same time. There also seems to be problems using an Xbox controller. I am currently using windows 10 Pro x64 but this problem existed with windows 7 also and with all releases of RetroFe that I have tried.

The second problem I appear to be having is that when playing platform videos, the audio will randomly stop part way through. This seems to be more of a problem when a 1920x1080 is reduced size within a theme. Just in case it is conflicting hardware, this is my PC spec. Intel core i7 2600K, AMD Radeon R9 390, Sound Blaster Recon 3D PCIe.

Other than these 2 problems, RetroFE is Excellent. The best frontend I have tried including one I have paid for!

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #1 on: December 30, 2016, 08:50:09 AM »
I'm not entirely happy with the event handling either; I don't have your specific issues, but I too see some irregularities when it comes to handling (keyboard in my case) input. Currently, input handling for the menus is handled separately in two different locations: the main handler looks at the input, and changes some internal states, and the menu itself handles the scrolling based on the internal state. I've been thinking about combining that in one location, but it will require a bit of structure rethinking. It has my attention though.

With regards to your videos: I encountered that issue in the past as well. I was under the impression that it was caused by a lack of hardware support for the video playback in combination with a slow CPU. It disappeared when I switched my CPU to turbo mode. Considering your CPU however (way faster than mine) I may need to rethink the source of this problem. RetroFE currently uses the gstreamer video library, and I've considered switching to another library for quite some time now. I may need to give that another look.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #2 on: December 30, 2016, 08:01:55 PM »
The input handler rewrite is coming along quite nicely. 😀

Sent from my SM-G920F using Tapatalk


ryuuji

  • Full Member
  • ***
  • Posts: 166
  • Karma: +1/-0
    • View Profile
Re: A Couple Of Issues
« Reply #3 on: December 30, 2016, 08:05:13 PM »
Cool. Looking forward to the next release

Multiplexer

  • Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #4 on: January 02, 2017, 08:55:24 PM »
I am also looking forward to the next release. The other problem, which has been mentioned before is that RetroFE always crashes on exit when there is a controller connected. This occurs with all 3 that I have. Dual shock 2, Dual Shock 4 and Xbox. The error pop up only occurs when windows error reporting is switched off (which I do), otherwise it silently crashes but is still logged in Windows Event Viewer:-

Faulting application name: retrofe.exe, version: 0.0.0.0, time stamp: 0x5807355e
Faulting module name: SDL2.dll, version: 2.0.4.0, time stamp: 0x5771dbfc
Exception code: 0xc0000005
Fault offset: 0x00145169
Faulting process ID: 0x1670
Faulting application start time: 0x01d26538a61a8fa9
Faulting application path: E:\RetroFE\core\retrofe.exe
Faulting module path: E:\RetroFE\core\SDL2.dll
Report ID: d785c078-0478-4abc-83b6-3a01b4aff312
Faulting package full name:
Faulting package-relative application ID:

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #5 on: January 03, 2017, 09:14:36 AM »
Yes, I'm familiar with that issue, but I haven't been able to reproduce it yet. I'm working on a Windows compile and debug environment though (I hardly ever use Windows, so it's a bit of a learning curve). Once I can reproduce it I can generally fix it. This is one of those times when it would really be useful to have more C++ developers working on a program, preferably on different operating systems. :)

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #6 on: January 06, 2017, 02:58:13 PM »
Controller crash issue is fixed in bit bucket.

Sent from my SM-G920F using Tapatalk


Multiplexer

  • Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #7 on: January 06, 2017, 09:51:31 PM »
Great, Thanks!

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #8 on: January 18, 2017, 10:20:08 PM »
Regarding the video issues: I notice my CPU has so little to do that it drops down to 800 MHz, which may cause the video playback issues... I haven't been able to stop it from doing that yet. 😢

Sent from my SM-G920F using Tapatalk


PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #9 on: January 19, 2017, 06:46:19 PM »
I was working a while ago on the video playback issues with gstreamer; I discovered that in some situations, the videos end up getting converted to a color format that isn't natively supported and thus requires a second color format conversion step even when decode acceleration is enabled. There are a couple of other inefficiencies as well (the code manually copies each video frame into a SDL texture, for example), but my experimentation at the time got confounded with some flaky hardware and trying to test on multiple platforms. I just recently fixed the flaky hardware, so I may take a crack at it again, but it was not an easy path to pursue! The interactions of gstreamer in its various versions, the OS video acceleration support with various cards and kernel and driver versions, SDL in its various versions, and the multithreaded RetroFE code was very frustrating at times.

When you just fire up the gstreamer command-line tools, they auto-configure to get the most efficient video playback possible, but this ends up being through a video overlay rather than integrating into a pre-existing display framework like SDL. This means that gstreamer is often decoding video frames directly into video memory, with no extra copies or translation. Efficiently getting video frames into SDL textures via gstreamer in a way that works for everyone was the source of most of my difficulty. Using a different video library might help, but I think a lot of the underlying difficulties will remain.

PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #10 on: January 19, 2017, 07:15:30 PM »
Regarding the audio associated with the video:

Currently RetroFE sets some "capabilities" for the video to a specific format and manually copies the frames into SDL textures, but doesn't specify anything about the audio. This means it'll automatically select the "best" audio playback for your system configuration, but it's going to be opening a separate connection to your system's audio framework than the one SDL is using for playing the sound effects associated with switching items and opening menus. When I tried running RetroFE on a Linux system that didn't have PulseAudio running, this meant that SDL grabbed the ALSA interface and neither the videos nor any games I launched were able to open the audio interface to play sound!

I made a pull request a while back that tried to address those problems by copying audio samples into SDL the same way video frames are, and by closing the audio interface before launching a game, but I think there may be some potential deadlock situations still lurking in the code that manages the audio and video locks, and my flaky hardware issues mentioned previously made me put off trying to fix it and re-upload at the time. I should try fixing this again with the latest version, though.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #11 on: January 19, 2017, 07:51:06 PM »
Please do. Provided it's stable, I'm very open to using a new video library.

Sent from my SM-G920F using Tapatalk


PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #12 on: January 20, 2017, 06:08:54 PM »
I'm not sure switching to a different video library would be as effective as just using gstreamer better; it's very full-featured and even has plugins to use most of the other video libraries, like the ffmpeg ones. At this point I've invested a lot of time in figuring out how gstreamer works, and I'm sure there's a significant learning curve for all the cross-platform video playback libraries.

Last night I got a significant improvement to video playback working, at least on a couple of Linux machines I had handy. I'll do more testing with Mac and Windows soon, but here's what I found:

1. The code was selecting the YUY2 pixel encoding for the raw video frames; this is a packed YUV format, which is a common default for streaming video sources like USB webcams, but is almost never used by stored media codecs such as the ones we use for screen-capture videos or DVD/BluRay. This meant that gstreamer automatically added a conversion layer in its decode process that would translate the native layered YUV (usually I420/IYUV) output of the codec, necessitating an entire buffer copy and software loop over each video frame before we even got access to it.

2. Each GstBuffer, which contains references to the raw video data for a frame, was being copied into a new buffer we allocated as soon as we received it. Then, on the display loop execution, we would copy that buffer's contents into the video's SDL Texture. This is an unnecessary extra copy of the frame data, which slows things down again a bit, and discards the metadata associated with the buffer. Instead of copying the data, I just increase the refcount on the GstBuffer and store that; then my display routine copies directly from the GstBuffer to the SDL Texture and decrements the GstBuffer refcount when it's done.

3. The current code doesn't take into account some subtleties of how the raw video frame data is sometimes stored.  I have some handheld emulation videos (GameBoy varieties) that displayed in a garbled manner because the video data is not contiguous in the frame buffer; each line is padded out to a power of 2 by the codec and the display routines are expected to deal with the difference between the video's horizontal resolution and the larger 'stride' of the data buffer, which was not being done.  When the buffer data is non-contiguous, gstreamer adds a GstVideoMeta structure to each GstBuffer; this describes the offset and stride of each plane in the buffer (they're not the same size, since each U or V sample covers the space of 4 Y samples in I420, for example) in a way that allows them to be mapped separately and passed into SDL_UpdateYUVTexture function. After adding this, all my videos played correctly!

I had perceptibly slow video playback and some input response lag on my i5 NUC machine, but it's apparently full-speed and more responsive to control input after my changes. I'll test them on Mac and Windows and some other Linux machines and then make a pull request once I'm fairly confident I didn't introduce any problems.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: A Couple Of Issues
« Reply #13 on: January 20, 2017, 06:40:02 PM »
Great news! Looking forward to it. I've also checked in some changes, so this should make a nice set for 0.7.20b4. I'm working towards a 0.7.20 full release again soon.

Sent from my SM-G920F using Tapatalk


Multiplexer

  • Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: A Couple Of Issues
« Reply #14 on: January 21, 2017, 12:53:46 AM »
Me too. In the mean time the solution for me was to just re-encode the video in the same resolution as that to which I wanted to show. Works perfectly then. As for the controller, that is now working great, thank you. I wish I knew how to do programming because I would love to help. As it stands the extent of my programming skills was when I had a C64 and I could do:

10 PRINT "HELLO"
20 GOTO 10
RUN

Man, I wish I had applied myself more at school!