Menu

#342 asound.conf not honoured

1.30.x
closed-fixed
nobody
None
5
2023-01-15
2022-09-19
No

my /etc/asound.conf configuration is not honoured by -t alsa.
I have to use "-t alsa -a sysdefault" to make mpg123 work with alsa at all (or default but that says

Warning: You triggered the NtoM drop-sample resampler inside libmpg123.
Warning: You could trade CPU for quality by forcing a supported output rate.

My asound.conf is

pcm.!default {
   type plug; slave.pcm { @func getenv; vars [ ALSAPCM ]; default "xmix"; }
}
ctl.!default { type hw; card 0; }

#pcm.xmix {
#   type dmix
#   ipc_key 1024; ipc_gid audio; ipc_perm 0660
#   slave { rate 48000; periods 256; period_time 0; period_size 2048;
#      buffer_size 16384; pcm "_xmix"; }
##   slave { rate 44100; period_size 8192; pcm "hda_intel"; }
#}
#pcm._xmix { type hw; card 0; }

pcm.xmix {
   type dmix
   ipc_key 1024; ipc_gid audio; ipc_perm 0660
   slave {
   #rate 48000; periods 256; period_time 0; period_size 2048; buffer_size 16384
   pcm "hw:0,0" }
}

pcm.bt {
   type plug
   slave.pcm { type bluealsa; device "00:F4:8D:33:38:FA"; profile "a2dp" }
   hint { show on; description "ptv, Frau Antje Bluetooth" }
}
ctl.bt { type bluealsa }

My --list-devices say

Devices for output module alsa:
null    Discard all samples (playback) or generate zero samples (capture)
bt      ptv, Frau Antje Bluetooth
sysdefault:CARD=PCH     HDA Intel PCH, ALC236 Analog Default Audio Device
front:CARD=PCH,DEV=0    HDA Intel PCH, ALC236 Analog Front output / input
surround21:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0       HDA Intel PCH, ALC236 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0     HDA Intel PCH, HDMI 0 HDMI Audio Output
hdmi:CARD=PCH,DEV=1     HDA Intel PCH, HDMI 1 HDMI Audio Output
hdmi:CARD=PCH,DEV=2     HDA Intel PCH, HDMI 2 HDMI Audio Output
hdmi:CARD=PCH,DEV=3     HDA Intel PCH, HDMI 3 HDMI Audio Output
hdmi:CARD=PCH,DEV=4     HDA Intel PCH, HDMI 4 HDMI Audio Output

Discussion

  • Thomas Orgis

    Thomas Orgis - 2022-09-20

    Which version is this?

    We use the device named 'default' by default. I though that's proper behaviour … and it seems it usually is.

    pcm_name = ao->device ? ao->device : "default";
    

    My --list-devices on an Ubuntu box says:

    Devices for output module alsa:
    default Playback/recording through the PulseAudio sound server
    surround21  2.1 Surround output to Front and Subwoofer speakers
    surround40  4.0 Surround output to Front and Rear speakers
    [...]
    sysdefault:CARD=PCH HDA Intel PCH, CX20561 Analog Default Audio Device
    front:CARD=PCH,DEV=0    HDA Intel PCH, CX20561 Analog Front speakers
    surround21:CARD=PCH,DEV=0   HDA Intel PCH, CX20561 Analog 2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=PCH,DEV=0   HDA Intel PCH, CX20561 Analog 4.0 Surround output to Front and Rear speakers
    [...]
    

    You got a sysdefault, but no default. But anyway, it should work when you specify -a sysdefault. And it does, doesn't it?

    The message you get is about the chosen device enforcing a certain sample rate that does not match the input file (likely 48000 Hz vs. 44100 Hz). Mpg123 resamples on the fly with a low-quality algorithm. If you explicitly tell mpg123 to resample via the -r <rate> parameter, it will use a better resampler unless you force the low-quality algorithm via --resample NtoM.

     
  • Steffen Nurpmeso

    $ cat /usr/ports/opt/mpg123/Pkgfile
    # Description: Commandline MP3 player
    # URL: https://www.mpg123.de
    # Maintainer: Juergen Daubert, jue at crux dot nu
    # Depends on: alsa-lib
    
    name=mpg123
    version=1.30.2
    release=1
    source=(https://sourceforge.net/projects/mpg123/files/mpg123/$version/$name-$version.tar.bz2)
    
    build() {
            cd $name-$version
            ./configure --prefix=/usr
            make
            make DESTDIR=$PKG install
    }
    
     
  • Steffen Nurpmeso

    I have seen the code snippet you show.
    I never programmed ALSA. But thing is (sorry that the only remaining mp2/mp3 file on my box, from the 1000dokumente of german history)

    $ mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 508 of 2304 (Success?)!
    
    [0:17] Decoding of 0008_pos_001-himmler-endloesung.mp3 finished.
    

    However $ALSAPCM=bt and no BT currently active, so other audio programs i have to start with "ALSAPCM=xmix PROG FILE". Not mpg123.
    -a sysdefault yes, but not libasound's /etc/asound.conf.

     
  • Steffen Nurpmeso

    Actually it works even without -a sysdefault.
    It seems yesterday it was so loud all around that i did not hear the first invocation's output. Then i looked due to that with the other noise reduced, but already with -o alsa, and then the rest with additional -a's.

    Still asound.conf (and my $ALSACPM thing) is not honoured even though mpg123 uses libasound.
    It is a pity that type bluealsa cannot sit under type dmix, but that is off-topic.

    So sorry for all the noise all around. But i leave this open. (I could not close it anyway.)

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-20

    Did you actually use -t alsa before? Because -t does something very different from -o.

    Anyhow … right now I do not understand how asound.conf is not honoured. Can you explain to me what should happen when? My work with ALSA setups is some time away. The main case should be that 'default' chooses the device you'd expect as default output device.

    Does the issue still persist or was this also a misunderstanding?

     
  • Steffen Nurpmeso

    Hello.
    mpg123 is flaky regarding this.

    p$ ALSAPCM=xmix ogg123 /x/music/recs.misc/nina_simone-feeling_good.ogg
    
    Audio Device:   Advanced Linux Sound Architecture (ALSA) output
    
    Playing: /x/music/recs.misc/nina_simone-feeling_good.ogg
    Ogg Vorbis stream: 2 channel, 48000 Hz
    Language: eng
    Encoder: Lavc58.54.100 libvorbis
    Time: 00:04.57 [02:52.65] of 02:57.23  (117.0 kbps)  Output Buffer  77.8%
    Time: 00:04.89 [02:52.34] of 02:57.23  (109.3 kbps)  Output Buffer  77.8%
    Time: 00:09.30 [02:47.93] of 02:57.23  (122.1 kbps)  Output Buffer  77.8%
    Time: 00:10.87 [02:46.35] of 02:57.23  (117.7 kbps)  Output Buffer  88.9%
    
    Done.
    # this was due to ^C
    #?0|kent:tmp$ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 1168 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    $ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 700 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    #?133|kent:tmp$ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 700 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    $ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 700 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    #?133|kent:tmp$ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 1168 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    #?133|kent:tmp$ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 1400 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    $ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 1212 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    #?133|kent:tmp$ ALSAPCM=xmix mpg123 /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():737] error: Error in writing audio, wrote only 700 of 2304 (Resource temporarily unavailable?)!
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    
    # BUT NOW
    
    $ mpg123 -o alsa -a sysdefault /x/doc/1000dok/0008_pos_001-himmler-endloesung.mp3
    High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
            version 1.30.2; written and copyright by Michael Hipp and others
            free software (LGPL) without any warranty but with best wishes
    
    Directory: /x/doc/1000dok/
    
    Terminal control enabled, press 'h' for listing of keys and functions.
    
    Playing MPEG stream 1 of 1: 0008_pos_001-himmler-endloesung.mp3 ...
    
    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    
    [0:09] Decoding of 0008_pos_001-himmler-endloesung.mp3 finished.
    # due to ^C
    
     
  • Steffen Nurpmeso

    Definetely, with "mpg123 -o alsa -a sysdefault" the problem does not happen.
    With "ALSAPCM=xmix mpg123" 9 of 10 fail (after some time)

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-20

    There is an element of chance if it works or not?! That is troubling. The failure is the error in writing, yes? But the selection of the correct audio device works with either -a sysdefault or the environment variable? What output is mpg123 using without any option? null?

     
  • Steffen Nurpmeso

    Yes! I tell you what i have compiled with DEBUG and XDEBUG only in libout123 just five minutes ago, but now too late (will be 5am until i am for sleep), so more in detail tomorrow, ok.
    But what i can tell you is that even "-o alsa -a sysdefault" sees the error, and it starts early like "for without", but with the args it continues, look:

    MPEG 2.0 L III cbr128 22050 stereo
    
    Title:   Ausschnitt                                                                                  Artist:
    Comment:                                                                                             Album:
    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b4f2c0, 188) (2)
    [src/libout123/libout123.c:out123_continue():612] debug: [15310]out123_continue(0x55a969aef450) 2
    [src/libout123/libout123.c:out123_play():726] debug: written: 188 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b4f37c, ...) = 188
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 11 (Resource temporarily unavailable), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x55a969aef450, 0x55a969b481c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [15310]out123_play(0x55a969aef450, 0x55a969b478c0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 11 (Resource temporarily unavailable), keep_on=16
    

    Compare this with "without":

    Year:                                                                                                Genre:  Blues
    
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b6e540, 188) (2)
    [src/libout123/libout123.c:out123_continue():612] debug: [16217]out123_continue(0x563d31b40450) 2
    [src/libout123/libout123.c:out123_play():726] debug: written: 188 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b6e5fc, ...) = 188
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 2304 errno: 0 (Success), keep_on=16
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b676c0, ...) = 2304
    [src/libout123/libout123.c:out123_play():685] debug: [16217]out123_play(0x563d31b40450, 0x563d31b66dc0, 2304) (3)
    [src/libout123/libout123.c:out123_play():726] debug: written: 1168 errno: 11 (Resource temporarily unavailable), keep_on=16
    [src/libout123/libout123.c:out123_play():741] error: Error in writing audio, wrote only 1168 of 2304 (Resource temporarily unavailable?)!
    [src/libout123/libout123.c:out123_play():748] debug: out123_play(0x563d31b40450, 0x563d31b67250, ...) = 1168
    main: [src/mpg123.c:play_frame():850] error: Deep trouble! Cannot flush to my output anymore!
    [src/libout123/libout123.c:out123_del():114] debug: [16217]out123_del(0x563d31b40450)
    [src/libout123/libout123.c:out123_close():502] debug: [16217]out123_close(0x563d31b40450)
    [src/libout123/libout123.c:out123_drain():774] debug: [16217]out123_drain(0x563d31b40450)
    [src/libout123/libout123.c:out123_pause():591] debug: [16217]out123_pause(0x563d31b40450) 3
    [src/libout123/libout123.c:out123_pause():600] debug: pause without buffer, sensitive=1
    [src/libout123/libout123.c:out123_stop():635] debug: [16217]out123_stop(0x563d31b40450)
    [src/libout123/libout123.c:modverbose():37] debug: modverbose: 10 0 8 0 0
    [src/libout123/libout123.c:out123_set_buffer():197] debug: out123_set_buffer(0x563d31b40450, 0)
    [src/libout123/libout123.c:out123_close():502] debug: [16217]out123_close(0x563d31b40450)
    [src/libout123/libout123.c:out123_drain():774] debug: [16217]out123_drain(0x563d31b40450)
    [src/libout123/libout123.c:out123_stop():635] debug: [16217]out123_stop(0x563d31b40450)
    
     
  • Steffen Nurpmeso

    But wait. If i check against EAGAIN not only EINTR in out123_play(), then we go!
    Question is: why do i reliably run into the "if(written < block" case without the arguments, whereas with the arguments it seems the block is fully written when we come to the condition?

     
  • Steffen Nurpmeso

    P.S. (for now): this 1168 bytes. Could it be that without exact device info a different block size is chosen? Just a thought

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-21

    Thanks for this investigation. This is another location that needs this check, apparently (compat/compat.c, unintr_write()):

                    } else if(errno != EINTR && errno != EAGAIN
    #if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
                            // Not all platforms define it (or only in more modern POSIX modes).
                            // Standard says it is supposed to be a macro, so simple check here.
                            && errno != EWOULDBLOCK
    #endif
    

    Good catch. So if you added EAGAIN, things work? This looks like a simple fix I should release quickly.

     
  • Steffen Nurpmeso

    Yes. Thanks for the patience.

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-21

    Cool. So I added a fix to svn trunk. Can you verify that the current https://mpg123.org/snapshot works for you (if you read this after 0300 CEST, in about 3 hours from now).

     
  • Steffen Nurpmeso

    Yes, works :)
    Ciao!

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-25

    Eh this is funny … by accident, the recent snapshot did not containt he fix, actually! I just now properly included it in trunk and triggered generation of a new snapshot.

    Can you verify again that

    1. The old build didn't really fix the issue reliably?
    2. The new snapshot does?

    Sorry for the confusion.

     
  • Steffen Nurpmeso

    Hello. Actually i did not use the snapshot, but came over SVN over a branch called "multinet" or something like this. I had to do autoreconf -vis but on CRUX Linux all this is anyway there, so no problem. I did a diff- too, because you talked about two places where the fix is needed, but the diff contained only one. The fix was definetely in this thing.

    Ciao!

     
  • Thomas Orgis

    Thomas Orgis - 2022-09-26

    How crafty. Yes, the fix landed in the multinet branch first.

     
  • Thomas Orgis

    Thomas Orgis - 2023-01-15
    • status: open --> closed-fixed
     

Log in to post a comment.