popcornmix / omxplayer

omxplayer
GNU General Public License v2.0
1.02k stars 332 forks source link

OMXPLAYER fails to exit properly and process gets stuck #437

Open horendus opened 8 years ago

horendus commented 8 years ago

Im trying to make a looping audio player

Basically my bash script checks if the OMXPLAYER process is running. If its not it assumes the track has finished playing so it triggers my PYTHON script to run which randomly selects a track and starts OMXPLAYER with that audio file. The python script then exits until called again.

The problem is randomly this system fails because the OMXPLAYER process stops closing down properly.

I know this is the problem because when this happens I can SSH in and run sudo killall -9 /usr/bin/omxplayer.bin

This kills OMXPLAYER and then the next track will immediately start playing because my BASH script will discover the OMXPLAYER process is not running, triggering the python script to run and start a new audio track.

Also note that after this happens ONCE OMXPLAYER will not exit again properly until I reboot the PI. After a reboot the system will work for between 30min - 2 days before falling over again.

This is the command im using to open OMXPLAYER and play the audio file. omxplayer -o local --no-keys "filename"

This is the result of running omxplayer -v Build date: Sat, 06 Feb 2016 16:37:51 +0000 Version : cb91001 [master

Im running the latest version of JESSIE-LITE image on PI2.

Can anyone either suggest a WORK AROUND or know how and why OMXPLAYER doesnt shut down correctly sometimes?

Im considering adding to my batch file a manual kill of the OMXPLAYER process (sudo killall -9 /usr/bin/omxplayer.bin) which is triggered after the duration of the track but im not sure how to get OMXPLAYER to RETURN the length of the current track, or return if its currently playing a file!

Any help would be MUCH appreciated!

jehutting commented 8 years ago

@horendus Is it possible to post/PM the script you are using? Just to be sure making the same runs for testing/debugging omxplayer hang-up.

To get the duration, you can use the -I (capital i) option. This shows some info on the STDERR stream. The line to look for is Duration: 00:02:04.65, start: 0.000000, bitrate: 129 kb/s Added on 27-March-2016: The position is shown on the STDOUT stream when using the -s option M: 4024160 V: -4.02s 0k/ 0k A: 6.22 -4.02s/ 7.61s Cv: 0k Ca: 565k The position is the value after the M:.

Another possibility is through D-BUS request 'Duration' and 'Position'. The usage can be found in dbuscontrol.sh status.

$ ./dbuscontrol.sh status Duration: 124648000 Position: 111445452 Paused: false

Duration and Position are in microseconds.

When omxplayer got stuck, you may get (I simply quit'ed omxplayer, so no omxplayer is running)

$ ./dbuscontrol.sh status Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.omxplayer was not provided by any .service files

asimovwasright commented 8 years ago

Hi All, I can confirm that I am experiencing the same issues with omxplayer running in a loop. I can post my scripts if needed, but I think that a firmware update on the pi may have fixed the problem.

rpi-update

The loop has been running since the update, for over 12 hours now without any hangup issues from omxplayer.

I will keep track over the coming days to make sure. I have adjusted my program to call omxplayer with the -I option, and I am capturing each instance's STERR to file, so I should be able to give useful info if it happens again.

Anyone who has any questions, please feel free to ask, I will be available 24/7 until this is fixed :-)

asimovwasright commented 8 years ago

Alas! At just before 5am today, the problem started again, and then happened again just before 8am.

I will post the lines from my own play-log; the first line is the track that would eventually not hangup correctly, and the second line is the following track, so you can see how long it was before the process ended finally. Then below each set of lines, there is the STERR from that offending track.

04-04-16[04:56:36] Playing  2-18 Katy B - Broken Record.mp3
04-04-16[05:09:02] Playing  2-06 David Guetta feat. Sam Martin - Lovers On The Sun.mp3

[mp3 @ 0x17f1120] Skipping 0 bytes of junk at 105899.
Input #0, mp3, from '/home/sbadmin/playlist1/2-18 Katy B - Broken Record.mp3':
  Metadata:
    title           : Broken Record
    artist          : Katy B
    track           : 18/22
    album           : Now That's What I Call Music! 79
    disc            : 2/2
    genre           : Pop
    TMED            : CD
    SCRIPT          : Latn
    originalyear    : 2011
    MusicBrainz Album Type: album/compilation
    MusicBrainz Album Artist Id: 89ad4ac3-39f7-470e-963a-56509c546377
    MusicBrainz Artist Id: feea8ed3-eb47-44d6-a480-f6ee85d95411
    BARCODE         : 5099908725028
    MusicBrainz Album Status: official
    MusicBrainz Album Id: 1ee5629a-bf8e-4df2-9aac-dd61d87414f7
    TSO2            : Various Artists
    album_artist    : Various Artists
    CATALOGNUMBER   : 50999 0 87 250 2 8/CDNOW79
    Artists         : Katy B
    MusicBrainz Release Track Id: 8010e3e9-fa84-380b-a4c0-4aa8f6d21ae1
    TORY            : 2011
    compilation     : 1
    MusicBrainz Release Group Id: 96a9391d-237e-4fda-8e14-691f1c4926de
    artist-sort     : Katy B
    TSRC            : GBARL1100102
    MusicBrainz Album Release Country: GB
    ASIN            : B0057EIYTI
    publisher       : NOW
    date            : 2011-07-25
  Duration: 00:03:20.62, start: 0.025056, bitrate: 257 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 252 kb/s
    Metadata:
      encoder         : LAME3.98r
    Side data:
      replaygain: track gain - -9.100000, track peak - unknown, album gain - unknown, album peak - unknown,
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 500x490 [SAR 1:1 DAR 50:49], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
[mp3 @ 0x1819c40] Could not update timestamps for skipped samples.
[mp3 @ 0x1819c40] Could not update timestamps for discarded samples.

04-04-16[07:48:12] Playing  06 Kid Cudi - Day 'n' Nite (Crookers remix radio edit).mp3
04-04-16[08:09:02] Playing  2-02 Cheryl - Call My Name.mp3

[mp3 @ 0x770160] Skipping 0 bytes of junk at 89515.
Input #0, mp3, from '/home/sbadmin/playlist1/06 Kid Cudi - Day 'n' Nite (Crookers remix radio edit).mp3':
  Metadata:
    title           : Day 'n' Nite (Crookers remix radio edit)
    artist          : Kid Cudi
    track           : 6/19
    album           : Now That's What I Call Club Hits
    disc            : 1/1
    genre           : Club
    TMED            : CD
    SCRIPT          : Latn
    originalyear    : 2009
    MusicBrainz Album Type: album/compilation
    MusicBrainz Album Artist Id: 89ad4ac3-39f7-470e-963a-56509c546377
    Release type    : Normal Release
    encoder         : LAME
    MusicBrainz Artist Id: e0e1db18-f7ba-4dee-95ff-7ae8cf545460
    Ripping tool    : EAC
    MusicBrainz Album Status: official
    MusicBrainz Album Id: 72e2de96-920b-4cca-9826-fd57ae445ce5
    TSO2            : Various Artists
    album_artist    : Various Artists
    Artists         : Kid Cudi
    MusicBrainz Release Track Id: 7204cd52-9bb9-3ebf-a5eb-52058523e6d9
    TORY            : 2009
    Source          : CD (LP)
    Rip date        : 2009-09-19
    compilation     : 1
    CATALOGNUMBER   : 88697 56256 2
    MusicBrainz Release Group Id: 42585a1b-bbe5-4bec-955e-afbf51d87a9b
    BARCODE         : 886975625628
    artist-sort     : Kid Cudi
    MusicBrainz Album Release Country: US
    ASIN            : B002GXG5B2
    publisher       : Sony Music
    date            : 2009-09-22
  Duration: 00:02:42.48, start: 0.025056, bitrate: 209 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 205 kb/s
    Metadata:
      encoder         : LAME3.97
    Side data:
      replaygain: track gain - -7.900000, track peak - unknown, album gain - unknown, album peak - unknown,
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
[mp3 @ 0x7fe940] Could not update timestamps for skipped samples.
[mp3 @ 0x7fe940] Could not update timestamps for discarded samples.
horendus commented 8 years ago

I'm glad we are getting some focus on this issue :)

If there's anything I can do to help (as original poster) let me know!

asimovwasright commented 8 years ago

Ye, not sure if focus is going to get us anywhere tho :'(

@jehutting Could you give any insight at all? I am leaning towards writing a script to simply check the duration, then kill the player after set time (as mentioned by @horendus ). Unless there us any better way :-)

jehutting commented 8 years ago

@asimovwasright Well the getting/handling of the duration and position is just a workaround of the real problem: 'why isn't omxplayer terminating', or in your case 'why does it take so long to terminate'. At this moment I don't have a clue. I will see if I can make a script which at least detects/reproduces the fault.

asimovwasright commented 8 years ago

Right, yes I re-read the op, and I see now that the duration was only for the workaround. I had thought you were looking to see if the program had incorrectly calculated the duration, leading to it taking too long to finish.

What can I do to help you? Any output or info you need, just let me know. :-)

On 5 April 2016 20:36:53 CEST, Jozef Hutting notifications@github.com wrote:

@asimovwasright Well the getting/handling of the duration and position is just a workaround of the real problem: 'why isn't omxplayer terminating', or in your case 'why does it take so long to terminate'. At this moment I don't have a clue. I will see if I can make a script which at least detects/reproduces the fault.


You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/popcornmix/omxplayer/issues/437#issuecomment-205938862

Tim Bauwens Base IT Systems +31(0)611 36 46 36

jehutting commented 8 years ago

Made a looping script

#!/bin/bash
# infinity-looper.sh
# Infinite looping script for debug purpose of OMXPLAYER issue #437
# J.E.HUTTING 05-APR-2016

#set -x # expand the commands

# set here the files to play ---------------------------------------------------
FILES=`ls /aragorn/music/singles/T*.mp3`
# ------------------------------------------------------------------------------
#echo $FILES

# who's playing it
OMXPLAYER="omxplayer"

echo "*****INFINITE LOOPING SCRIPT!!!"
echo "*****ABORT WITH CTRL+C"
while true; do
    while true; do
        IFS=$'\012'   # IFS: Internal field separator ; \12=new line '\n'
        for entry in $FILES
        do
            IFS=$' \t\n'
            echo $entry

            # let's play (in background)
            echo `date +%d-%m-%Y" "%H:%M:%S`
            $OMXPLAYER -I "$entry" &

            # wait to allow omxplayer to start
            STARTUP=2
            sleep $STARTUP 

            # retrieve duration
            duration=`dbus-send --print-reply=literal --session --reply-timeout=500 --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Duration`
            if [ $? -ne 0 ]; then exit 1; fi
            duration="$(awk '{print $2}' <<< "$duration")"
            duration=$((duration/1000000))
            echo "*****DURATION = $duration seconds"

            # wait (approximately) playing time - waiting for startup + one extra second
            duration=$((duration - $STARTUP + 1))
            sleep $duration

            echo `date +%d-%m-%Y" "%H:%M:%S`
            echo "*****OMXPLAYER SHOULD HAVE WISHED US A NICE DAY..."

            while true; do
                # No omxplayer should be hanging around...
                if ps ax | grep -v grep | grep $OMXPLAYER > /dev/null
                then
                    echo `date +%d-%m-%Y" "%H:%M:%S`
                    EXTRA=2
                    echo "*****STILL AROUND? GIVING IT SOME EXTRA $EXTRA SECONDS..."
                    sleep $EXTRA
                    if ps ax | grep -v grep | grep $OMXPLAYER > /dev/null
                    then
                         echo `date +%d-%m-%Y" "%H:%M:%S`
                         echo "*****OEPS THE ERROR...BECAUSE OMXPLAYER SHOULD HAVE FINISHED BY NOW!"
                         echo "*****RUN 'sudo pkill $OMXPLAYER' manually to stop omxplayer." 
                         exit 2
                     fi
                else
                    echo "*****SUCCESSFULLY PLAYED*****"
                    break
                fi
            done
        done
    done
done

Output:

$ ./infinity-looper.sh 
*****INFINITE LOOPING SCRIPT!!!
*****ABORT WITH CTRL+C
/aragorn/music/singles/T99 - Anasthasia (Out Of History Mix).mp3
05-04-2016 22:59:42
[mp3 @ 0xd91ad0] Skipping 0 bytes of junk at 1044.
Input #0, mp3, from '/aragorn/music/singles/T99 - Anasthasia (Out Of History Mix).mp3':
  Duration: 00:04:35.44, start: 0.025057, bitrate: 320 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.99r
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
[mp3 @ 0xdb3240] Could not update timestamps for skipped samples.
*****DURATION = 275 seconds
[mp3 @ 0xdb3240] Could not update timestamps for discarded samples.
have a nice day ;)
05-04-2016 23:04:18
*****OMXPLAYER SHOULD HAVE WISHED US A NICE DAY...
*****SUCCESSFULLY PLAYED*****
/aragorn/music/singles/Taja Sevelle - Love Is Contagious.mp3
05-04-2016 23:04:18
[mp3 @ 0x419ac0] Skipping 0 bytes of junk at 1044.
Input #0, mp3, from '/aragorn/music/singles/Taja Sevelle - Love Is Contagious.mp3':
  Duration: 00:04:38.18, start: 0.025057, bitrate: 320 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.99r
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
[mp3 @ 0x43ad50] Could not update timestamps for skipped samples.
*****DURATION = 278 seconds
[mp3 @ 0x43ad50] Could not update timestamps for discarded samples.
have a nice day ;)
05-04-2016 23:08:57
*****OMXPLAYER SHOULD HAVE WISHED US A NICE DAY...
*****SUCCESSFULLY PLAYED*****
/aragorn/music/singles/Take That - Everything Changes.mp3
05-04-2016 23:08:57
[mp3 @ 0x7fcac0] Skipping 0 bytes of junk at 18486.
Input #0, mp3, from '/aragorn/music/singles/Take That - Everything Changes.mp3':
  Metadata:
    artist          : Take That
    encoded_by      : Free Mp3 Wma Converter
    title           : Everything Changes
  Duration: 00:03:35.80, start: 0.025057, bitrate: 320 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.98r
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
[mp3 @ 0x81f370] Could not update timestamps for skipped samples.
*****DURATION = 215 seconds
[mp3 @ 0x81f370] Could not update timestamps for discarded samples.
[mp3 @ 0x81f370] Header missing
05-04-2016 23:12:33
*****OMXPLAYER SHOULD HAVE WISHED US A NICE DAY...
have a nice day ;)
*****SUCCESSFULLY PLAYED*****
/aragorn/music/singles/Talking Heads - Psycho Killer.mp3
05-04-2016 23:12:34
[mp3 @ 0x2feac0] Skipping 0 bytes of junk at 1024.
[mp3 @ 0x2feac0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/aragorn/music/singles/Talking Heads - Psycho Killer.mp3':
  Metadata:
    title           : Psycho Killer
    artist          : Talking Heads
    genre           : New Wave
  Duration: 00:04:18.73, start: 0.000000, bitrate: 128 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
*****DURATION = 258 seconds
...

Will run this script on a RPI B Raspbian and on a RPI2B Jessie. Let see what happens...

asimovwasright commented 8 years ago

OK cool! Although, I am not 100% sure that the player won't exit with the "have a nice day..." output even when it takes 2 hours. So, you may not be able to see the error when searching the output (which may be thousands of lines by then, so not easy to look with your own eyes).

What would you be looking for in the output of a track where the error occurred? Maybe I already have that.

p.s. I am using a PI2 with Raspbian-Lite, so I installed the OMXPlayer from repo. Is there a beta version you would prefer me to test on?

Thanks for the help btw!

jehutting commented 8 years ago

The purpose of my script is just to see if omxplayer faults.

The script starts OMXPlayer and after two seconds it requests for the duration. Then the script goes asleep for this duration, while OMXPlayer keeps playing in the background. When the duration elapses, OMXPlayer may have finished playing. If not, the script waits an extra two seconds. Why not doing direct the extra time? I don't know what I was thinking last night :-) After this extra time OMXPlayer must have finished. If not, the script exits.

I will add logging (-g option) and a counter.

I'm running standard Jessie with latest update/upgrade.

@asimovwasright try to get the latest version from sergio.

So far both RPIs are still playing fine...

asimovwasright commented 8 years ago

Ah right, I get it now. I was too sleepy to read the bash properly :-) I have now installed the latest version cb91001

I am now also running the -g option, and I will send you the log file of the next track to produce the issue.

On 06-04-16 19:16, Jozef Hutting wrote:

The purpose of my script is just to see if omxplayer faults.

The script starts OMXPlayer and after two seconds it requests for the duration. Then the script goes asleep for this duration, while OMXPlayer keeps playing in the background. When the duration elapses, OMXPlayer /may/ have finished playing. If not, the script waits an extra two seconds. /Why not doing direct the extra time? I don't know what I was thinking last night :-)/ After this extra time OMXPlayer /must/ have finished. If not, the script exits.

I will add logging (-g option) and a counter.

I'm running standard Jessie with latest update/upgrade.

@asimovwasright https://github.com/asimovwasright try to get the latest version from sergio http://omxplayer.sconde.net/.

So far both RPIs are still playing fine...

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/popcornmix/omxplayer/issues/437#issuecomment-206471120

Tim Bauwens Base IT Systems +31(0)611 36 46 36 tel:0031611364636 https://base-it-systems.com /A Developer for the people.../

asimovwasright commented 8 years ago

One thing I noticed already: The log file that is generated with the -g shows times which are 2 hours behind the system time. I doubt it is related to the issue, but worth mentioning.

jehutting commented 8 years ago

@asimovwasright difference in system time on your host system (from which you ssh to your RPI) or on the RPI? It is probably due to a difference in timezone. We in the Netherlands have CEST. On my RPI the (default?) timezone is UTC. You can change it with sudo dpkg-reconfigure tzdata. So, nothing to worry about.

Still, if someone has the same problem as the OP and is willing to share his/her scripts, please do so (by sending it by PM)?

Both my RPIs are still running (now for 18 hours)...

asimovwasright commented 8 years ago

System time is on the RPi itself, which is set to the correct timezone - which is CEST, as I am also in the Netherlands :-) But that makes sense then, if the log is UTC.

Tonight I will most likely have an occurrence of the issue, so I will be able to send the entire log file of the track that caused it.

jehutting commented 8 years ago

Logging time is by gettimeofday.

Running my script now for two days; played 978 mp3's (both my RPIs). I aborted the script as it will probably not lead to the fault.

asimovwasright commented 8 years ago

I have encountered the fault again. This time the player never returned, although the process was clearly still running, in sleeping state. I have the following info to give, just let me know how you would like me to deliver it:

I can give you my program script, but it is kinda long and involved, but if you think there is any benefit in seeing it, then I will give it up.

jehutting commented 8 years ago

@asimovwasright You can put the log files & screenshot on dropbox as others can look at it too.

I'm interested in the script, as I can't reproduce the fault. You can mail it (and logging/screenshot) to my private email account xxx@xxx.xxx.

asimovwasright commented 8 years ago

OK, I don't use dropbox, so I will upload the files here. And I will send you the script privately. Debug-Files.zip

jehutting commented 8 years ago

OK got your mail. Thanks!

I saw a lot of omxplayer.bin in your htop screenshot. Would expect to see only one. Never saw this :-)

The logging shows also a strange thing; when the playing is done (IsEOS) there is no exiting thread messages. Question which arise is: Is omxplayer really waiting on it threads to be ended? We had a problem in the past with that...

I will have a deeper look at it.

asimovwasright commented 8 years ago

Hmmm, ye I always wondered about that.. Well, let me know if there are any specific tests you want me to perform. :-)

jehutting commented 8 years ago

Installed htop and saw the multiple omxplayer.bin too !? Are these threads???? Edit: Yes they are. Change the settings (F2) / Display Options and check [x] "Show custom thread names". Interesting...but which omxplayer.bin thread is the main/audio/video/subtile/keyboard?

Nothing wrong with @asimovwasright script (as far as I understood it :-)

Looks from the logging that the closing of the threads is still faulty. Thought it was fixed in issue #187.

Although... not for the subtitling... @asimovwasright : first try out my omxplayer.bin I PM-ed. @ others: try to run with '--no-osd' option.

Thanks.

horendus commented 8 years ago

Any confirmation if these suggestions have fixed the OMXplayer exiting issue once and for all?

@asimovwasright : first try out my omxplayer.bin I PM-ed. @ others: try to run with '--no-osd' option.

jehutting commented 8 years ago

Apparently not by you :-)

So short answer: no.

My testrig is already running a couple of days:

#1267: /aragorn/music/singles/The Kinks - Lola (Live).mp3
14-04-2016 04:35:23  <= 10-04-2016 19:02:49

1267 MP3s played (from 10th april).

asimovwasright commented 8 years ago

Sorry, I have had the issue again, running the deb package. I will pm the log files of the tracks that failed asap.

On 14 April 2016 06:46:53 CEST, Jozef Hutting notifications@github.com wrote:

Apparently not by you :-)

So short answer: no.

My testrig is already running a couple of days:

#1267: /aragorn/music/singles/The Kinks - Lola (Live).mp3
14-04-2016 04:35:23  <= 10-04-2016 19:02:49

1267 MP3s played (from 10th april).


You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/popcornmix/omxplayer/issues/437#issuecomment-209759624

Tim Bauwens Base IT Systems +31(0)611 36 46 36

horendus commented 8 years ago

True, I haven't tried the fix attempt yet. I gave up on OMXPLAYER as a stable MP3 looper a few weeks back and switched to MPLAYER, as it also handles Playlist Looping

Its however only stays up for a similar period of time before falling over with " AO: [pulse] Init failed: Connection refused " and refusing to play any more audio until a reboot (Sorry for going slightly off topic!)

That being said I will switch back to OMXPLAYER if a confirmed stable release is available.

I really thought a stable looping pi mp3 player would have been as simple as "pi" ...

asimovwasright commented 8 years ago

Urg... The log was not saved for the track that didn't exit properly... My fault, sorry. I will make sure the next one saves correctly.

asimovwasright commented 8 years ago

OK, I logged a few times when OMXPlayer has not exited. Included in the debug files are:

Let me know if there is any other info you need :-) Debug-Files[17-04].zip

jehutting commented 8 years ago

Thanks again @asimovwasright for the logging.

MY MODIFIED CODE @asimovwasright is running

void OMXPlayerSubtitles::Close() BOOST_NOEXCEPT
{
  CLog::Log(LOGDEBUG, "%s::%s\n", "OMXPlayerSubtitles", __func__);
  if(Running())
  {
    SendToRenderer(Message::Stop{});
    CLog::Log(LOGDEBUG, "%s::%s Stopping Thread\n", "OMXPlayerSubtitles", __func__);
    StopThread();
    CLog::Log(LOGDEBUG, "%s::%s Thread stopped OK\n", "OMXPlayerSubtitles", __func__);
  }

  m_mailbox.clear();
  m_subtitle_buffers.clear();

#ifndef NDEBUG
  m_open = false;
#endif
  CLog::Log(LOGDEBUG, "%s::%s OK\n", "OMXPlayerSubtitles", __func__);
}

FAILED-TRACK

03:30:19 T:18446744073123273461    INFO: COMXAudio::IsEOS
03:30:19 T:18446744073123273577   DEBUG: OMXClock::OMXStop
03:30:19 T:18446744073123274527   DEBUG: OMXPlayerSubtitles::Close
03:30:19 T:18446744073123274636   DEBUG: OMXPlayerSubtitles::Close Stopping Thread
.......WHAT HAPPENS HERE????....
04:11:59 T:1913497151   DEBUG: OMXThread::Run - Exited thread with  id 1914696784      
04:11:59 T:1913498167   DEBUG: OMXThread::StopThread - Thread stopped
04:11:59 T:1913498322   DEBUG: OMXPlayerSubtitles::Close Thread stopped OK
04:11:59 T:1913498413   DEBUG: OMXPlayerSubtitles::Close OK
04:11:59 T:1913498490   DEBUG: OMXPlayerVideo::Close
04:11:59 T:1913498570   DEBUG: OMXPlayerVideo::Close OK
04:11:59 T:1913498647   DEBUG: OMXPlayerAudio::Close
04:11:59 T:1913516380   DEBUG: OMXPlayerAudio::Close Wake up
04:11:59 T:1913516541   DEBUG: OMXPlayerAudio::Close Stopping Thread
04:11:59 T:1913516660   DEBUG: OMXPlayerAudio::Process OK
04:11:59 T:1913516845   DEBUG: OMXThread::Run - Exited thread with  id 1902646352
04:11:59 T:1913517087   DEBUG: OMXThread::StopThread - Thread stopped
04:11:59 T:1913517186   DEBUG: OMXPlayerAudio::Close Thread stopped OK
04:11:59 T:1913518666   DEBUG: COMXCoreComponent::DecoderEventHandler - OMX.broadcom.audio_mixer Ignoring expected event: eEvent(0x1), nData1(0x8000101c), nData2(0x0), pEventData(0x(nil))
04:11:59 T:1913576821   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_decode handle 0xd33de0
04:11:59 T:1913595999   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_mixer handle 0x70d1bee8
04:11:59 T:1913598226   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_render handle 0x70d1c008
04:11:59 T:1913598972   DEBUG: OMXPlayerAudio::Close OK
04:11:59 T:1913611322   DEBUG: OMXThread::Run - Exited thread with  id 1925182544
04:11:59 T:1913611617   DEBUG: OMXThread::StopThread - Thread stopped
04:11:59 T:1913616484   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.clock handle 0xc93860
04:11:59 T:1913617809   DEBUG: OMXPlayerSubtitles::Close
04:11:59 T:1913617943   DEBUG: OMXPlayerSubtitles::Close OK
04:11:59 T:1913618073   DEBUG: OMXPlayerAudio::Close
04:11:59 T:1913618155   DEBUG: OMXPlayerAudio::Close OK
04:11:59 T:1913619590   DEBUG: OMXPlayerVideo::Close
04:11:59 T:1913619703   DEBUG: OMXPlayerVideo::Close OK

WORKING-TRACK

06:08:17 T:301334998    INFO: COMXAudio::IsEOS
06:08:17 T:301335082   DEBUG: OMXClock::OMXStop
06:08:17 T:301336053   DEBUG: OMXPlayerSubtitles::Close
06:08:17 T:301336150   DEBUG: OMXPlayerSubtitles::Close Stopping Thread
06:08:17 T:301353736   DEBUG: OMXThread::Run - Exited thread with  id 1913648208
06:08:17 T:301354445   DEBUG: OMXThread::StopThread - Thread stopped
06:08:17 T:301354569   DEBUG: OMXPlayerSubtitles::Close Thread stopped OK
06:08:17 T:301354650   DEBUG: OMXPlayerSubtitles::Close OK
06:08:17 T:301354721   DEBUG: OMXPlayerVideo::Close
06:08:17 T:301354795   DEBUG: OMXPlayerVideo::Close OK
06:08:17 T:301354864   DEBUG: OMXPlayerAudio::Close
06:08:17 T:301372698   DEBUG: OMXPlayerAudio::Close Wake up
06:08:17 T:301372840   DEBUG: OMXPlayerAudio::Close Stopping Thread
06:08:17 T:301372943   DEBUG: OMXPlayerAudio::Process OK
06:08:17 T:301373043   DEBUG: OMXThread::Run - Exited thread with  id 1901597776
06:08:17 T:301373324   DEBUG: OMXThread::StopThread - Thread stopped
06:08:17 T:301373427   DEBUG: OMXPlayerAudio::Close Thread stopped OK
06:08:17 T:301375818   DEBUG: COMXCoreComponent::DecoderEventHandler - OMX.broadcom.audio_mixer Ignoring expected event: eEvent(0x1), nData1(0x8000101c), nData2(0x0), pEventData(0x(nil))
06:08:17 T:301433372   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_decode handle 0x114fd90
06:08:17 T:301452060   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_mixer handle 0x70c03d58
06:08:17 T:301454476   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_render handle 0x70c03e78
06:08:17 T:301455190   DEBUG: OMXPlayerAudio::Close OK
06:08:17 T:301456833   DEBUG: OMXThread::Run - Exited thread with  id 1924133968
06:08:17 T:301457127   DEBUG: OMXThread::StopThread - Thread stopped
06:08:17 T:301460901   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.clock handle 0x114ecd8
06:08:17 T:301462106   DEBUG: OMXPlayerSubtitles::Close
06:08:17 T:301462239   DEBUG: OMXPlayerSubtitles::Close OK
06:08:17 T:301462370   DEBUG: OMXPlayerAudio::Close
06:08:17 T:301462450   DEBUG: OMXPlayerAudio::Close OK
06:08:17 T:301463899   DEBUG: OMXPlayerVideo::Close
06:08:17 T:301464022   DEBUG: OMXPlayerVideo::Close OK

I will investigate this further.

@asimovwasright can you re-run your script WITH the '--no-osd' option added? Lets look what that brings us.

@horendus I am just trying to locate the problem. There is no fix yet :-) In the meanwhile, try re-run your script WITH the '-g' AND '--no-osd' option too. The more faulty logging, the better!?

My testrig won't go into failure :-)))

#2250: /aragorn/music/singles/The J.Geils Band - Centerfold.mp3
16-04-2016 19:55:04  <= 10-04-2016 19:02:49

Played 2250 MP3s in 6 days without a fault. Aborted it..

Ruffio commented 8 years ago

@horendus what are you saying? Still an issue? Have you tried @jehutting suggestion?

OMID-313 commented 8 years ago

I have been using omxplayer as a video-looper for more than a year. Almost 12 months ago, I didn't have this weird freeze problem (RPi 1 B+, Raspbian OS). But from almost 7 months ago, I've experienced this issue often (RPi 2 B, Minibian OS).

I'd be happy to see a stable release of omxplayer without this freeze bug. Because many people are using omxplayer as a video-looper.

New news on this bug fix? @popcornmix @turingmachine @Tito1337 @jehutting

jehutting commented 8 years ago

@OMID-313 everyone would be happy with a stable release :-). As I already said, this issue is still under investigation (I can't reproduce this freezing!). When you can reproduce or tell when and how... Please send a log file of your run on the RPi 2B (Jessie? ONLY, not minibian as I don't have it). Ideal would be a sample file which freezes omxplayer every time... Also have a look at # 451 about a current issue with Jessie GUI (with an upcoming fix soon).

Try to run omxplayer with '--no-osd' option as stated above.

asimovwasright commented 8 years ago

Hi All, I had the issue again, running the latest .bin from @jehutting - without the --no-osd option. According to my logs, the issue happened multiple times within a short period of time, which is a behavior I have noticed before. I attached the debug.zip that has in it the extended log file from the track which did not hangup - and the log file of the same track when it worked fine. I also included the extracts from my own log file which shows the duration of the hangup issue on the failed track.

I hope this info helps to find a solution, I will continue to log and update. Debug-14-05-2016.zip

OMID-313 commented 8 years ago

@asimovwasright , Did you upgrade to the latest framework update release ? https://github.com/popcornmix/omxplayer/issues/451

asimovwasright commented 8 years ago

I am using: omxplayer - Commandline multimedia player for the Raspberry Pi SPECIAL VERSION - JEHUTTING - FOR DEBUG PURPOSE ISSUE #437 ONLY Build date: Thu, 28 Apr 2016 07:12:16 +0200 Version : 17b81a8 [master] Repository: https://github.com/popcornmix/omxplayer.git

OMID-313 commented 8 years ago

@asimovwasright , I mean the latest framework update for raspbian jessie. https://www.raspberrypi.org/blog/another-update-raspbian/

asimovwasright commented 8 years ago

oh right, hahah

No idea if it's the 'latest' framework... I have only done the basic updates since installing in March

Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Linux version 4.1.19-v7+

popcornmix commented 8 years ago

Run

sudo apt-get update
sudo apt-get dist-upgrade

and reboot and then report if you still have issues.

jehutting commented 8 years ago

@asimovwasright That's a good advice from popcornmix. There were some issues with Jessie. When you do so my version will be overwritten, but that's fine ;-).

jehutting commented 8 years ago

Just for the record the added logging in SubtitleRenderer.cpp

void SubtitleRenderer::destroy_window() {  
  if (dispman_element_) {
    CLog::Log(LOGDEBUG, "%s::%s vc_dispmanx_update_start\n", "SubtitleRenderer", __func__);
    auto dispman_update = vc_dispmanx_update_start(0);
    assert(dispman_update);

    if (dispman_update) {
      CLog::Log(LOGDEBUG, "%s::%s vc_dispmanx_element_remove\n", "SubtitleRenderer", __func__);
      auto error = vc_dispmanx_element_remove(dispman_update, dispman_element_);
      assert(!error);

      CLog::Log(LOGDEBUG, "%s::%s vc_dispmanx_update_submit_sync\n", "SubtitleRenderer", __func__);
      error = vc_dispmanx_update_submit_sync(dispman_update);
      assert(!error);
    }

    CLog::Log(LOGDEBUG, "%s::%s #A\n", "SubtitleRenderer", __func__);
    dispman_element_ = {};
  }

  if (dispman_display_) {
    CLog::Log(LOGDEBUG, "%s::%s vc_dispmanx_display_close\n", "SubtitleRenderer", __func__);
    auto error = vc_dispmanx_display_close(dispman_display_);
    assert(!error);

    CLog::Log(LOGDEBUG, "%s::%s #B\n", "SubtitleRenderer", __func__);
    dispman_display_ = {};
  }
  CLog::Log(LOGDEBUG, "%s::%s done\n", "SubtitleRenderer", __func__);
}

The failed logging:

...
10:48:35 T:572390315   DEBUG: SubtitleRenderer::destroy destroying window
10:48:35 T:572390422   DEBUG: SubtitleRenderer::destroy_window vc_dispmanx_update_start
10:48:35 T:572390700   DEBUG: SubtitleRenderer::destroy_window vc_dispmanx_element_remove
10:48:35 T:572390836   DEBUG: SubtitleRenderer::destroy_window vc_dispmanx_update_submit_sync
11:51:29 T:50750370   DEBUG: SubtitleRenderer::destroy_window #A
11:51:29 T:50750648   DEBUG: SubtitleRenderer::destroy_window vc_dispmanx_display_close
11:51:29 T:50750817   DEBUG: SubtitleRenderer::destroy_window #B
11:51:29 T:50750907   DEBUG: SubtitleRenderer::destroy_window done
....

Again BIG THANKS to @asimovwasright getting the logging. Also for the countless hours listening to Coldplay...

asimovwasright commented 8 years ago

You're most welcome for the logging - but the Coldplay has made my soul weep... :-)

OMID-313 commented 8 years ago

@asimovwasright , Did you run

sudo apt-get update
sudo apt-get dist-upgrade

and test the system? Is everything ok !?

OMID-313 commented 8 years ago

@popcornmix , When will the newest bug fixes (white flicker, loop problem, etc.) be included in the latest build at http://omxplayer.sconde.net/ !? Your time and help is highly appreciated.

asimovwasright commented 8 years ago

Happened again after update, dist-upgrade & reboot...

19-05-16[13:40:20] Playing 01 Bruno Mars - Locked Out of Heaven.mp3 19-05-16[13:55:59] Playing 1-19 D'banj - Oliver Twist (Ruff Loaderz remix).mp3 Unfortunately I have run out of time, and I can't log anymore. I will use the --no-osd option - which seemed to work the best.

Good Luck everyone! If you have any specific questions, feel free to reach out.

Ruffio commented 8 years ago

@asimovwasright are you still experiencing this issue?

pcwalden commented 8 years ago

I am experiencing this problem playing audio mp3's.

uname -a Linux walden4 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

--no-osd option stops the problem.

popcornmix commented 8 years ago

@pcwalden do you have enough gpu_mem set? Try setting gpu_mem=128 and trying?

asimovwasright commented 8 years ago

@Ruffio - Yes, I can confirm that the issue hasn't changed, however if you are running audio only, then using the --no-osd argument will fix the problem.

Ruffio commented 8 years ago

@asimovwasright have you tried the @popcornmix suggested GPU memory setting?

asimovwasright commented 8 years ago

@Ruffio, No, sorry I am not working on that project anymore. I might pick it up again soon, in which case that will be the first thing I do, and I will let you know. :-)

OMID-313 commented 8 years ago

I've set gpu_mem=512 in RPi 3, but the problem is still there.