Bug 772491

Summary: Blank pause after exit
Product: [Fedora] Fedora Reporter: ccrisis
Component: pulseaudioAssignee: Lennart Poettering <lpoetter>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: belegdol, brendan.jones.it, chkr, lkundrak, lpoetter, lucilanga, matthias, ppisar, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: http://bugzilla.libsdl.org/show_bug.cgi?id=1449
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 17:45:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description ccrisis 2012-01-08 20:39:35 UTC
Description of problem:
When exiting scummvm, there is a blank pause of several seconds before it actually closes.

I'm not sure if it's related, but running scummvm in terminal shows this:
WARNING: SDL mixer output buffer size: 1024 differs from desired: 2048!

Version-Release number of selected component (if applicable):
scummvm-1.4.0-1.fc16.x86_64

How reproducible:
Always

Comment 1 Christian Krause 2012-02-05 17:10:57 UTC
I have investigated the issue and I can confirm the described behavior.

However, on my system many SDL-based programs suffer from the same problem:

- e.g. xrick, another SDL-based game, takes also 2-3s to quit
- a small SDL test binary which just opens and closes SDL's audio component runs for 2-3s

chkr@:~/test$ cat sdltest.c 
#include "SDL.h"
#include "SDL_audio.h"

void my_audio_callback(void *userdata, Uint8 *stream, int len) {};

int main()
{
    SDL_AudioSpec format;
    format.freq = 22050;
    format.format = AUDIO_S16;
    format.channels = 2;
    format.samples = 512;
    format.callback = my_audio_callback;
    format.userdata = NULL;

    if ( SDL_OpenAudio(&format, NULL) < 0 ) {
        fprintf(stderr, "SDL_OpenAudio(): %s\n", SDL_GetError());
        exit(1);
    }

    SDL_CloseAudio();
}
chkr@:~/test$ gcc -o sdltest sdltest.c `pkg-config --cflags --libs sdl`
chkr@:~/test$ time ./sdltest 

real	0m2.044s
user	0m0.006s
sys	0m0.011s

- other SDL users have the same problem: http://forums.libsdl.org/viewtopic.php?t=6947

I'll move the bug to the SDL component.

Comment 2 Petr Pisar 2012-02-28 13:40:33 UTC
I don't use pulseaudio. Plain ALSA terminates quickly for me. Can you please confirm this problem exhibits only with pulseaudio back-end? The SDL audio back-end can be selected by setting environment variable SDL_AUDIODRIVER to `alsa' or 'pulse'. Please make sure your ALSA library does not redirects to pulseaudio while testing.

Comment 3 Petr Pisar 2013-01-16 16:34:05 UTC
I can confirm issue. It polls in pulseaudio library.

Upstream report with work-around <http://bugzilla.libsdl.org/show_bug.cgi?id=1449>.

However it looks more like a bug in pulseaudio. Unfortunately <http://pulseaudio.org/ticket/866> does not work anymore.

Comment 4 Petr Pisar 2013-01-16 16:35:54 UTC
SDL audio finish function is:

static void stream_drain_complete(pa_stream *s, int success, void *userdata) {
}

static void PULSE_WaitDone(_THIS)
{
    pa_operation *o;

    o = SDL_NAME(pa_stream_drain)(stream, stream_drain_complete, NULL);
    if (!o)
        return;

    while (SDL_NAME(pa_operation_get_state)(o) != PA_OPERATION_DONE) {
        if (SDL_NAME(pa_context_get_state)(context) != PA_CONTEXT_READY ||
            SDL_NAME(pa_stream_get_state)(stream) != PA_STREAM_READY ||
            SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
            SDL_NAME(pa_operation_cancel)(o);
            break;
        }
    }
    SDL_NAME(pa_operation_unref)(o);
}

The delay is spent in PA's pa_mainloop_iterate() despite the stream buffer is empty.

Comment 5 Fedora End Of Life 2013-07-04 06:14:28 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2013-08-01 17:45:19 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.