Time reading issues with 4.8.x kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Some Rosegarden users recently reported a problem when moving from kernel 
4.7.5 or previous to 4.8.3 or 4.8.4: the cursor showing the advance of the 
MIDI sequencer sticks to its starting position and sound is no more produced.

Debugging the code, it appears that the time repeatedly read from ALSA with 
snd_seq_get_queue_status() has a changing nanoseconds part, but an always 0 
seconds part.

This can be easily shown with the attached timetest.c program:

$ uname -rsp
Linux 4.4.26-desktop-1.mga5 x86_64
$ ./timetest
1.111185000 s
2.222389000 s
3.333583000 s
4.444769000 s
5.555969000 s
6.667168000 s
7.778362000 s
8.889583000 s
10.000850000 s
11.112045000 s
$

$ uname -rsp
Linux 4.8.4 x86_64
$ ./timetest 
0.000189483 s
0.000410668 s
0.000611312 s
0.000804993 s
0.000996216 s
0.000191040 s
0.000383909 s
0.000576614 s
0.000771814 s
0.000965598 s
$ 

Is some change to the way we are using the ALSA API needed with this new 
kernels?
Should we use some workaround?

Thanks for your help.
-- 
Yves
// ALSA timetest
// Clemens Ladisch
// From comp.music.midi 4/28/2011,
// "ALSA snd_seq_queue_status_get_real_time tv_sec=0 ?"
//
// Tests snd_seq_get_queue_status() and snd_seq_queue_status_get_real_time().
// 
// Build with:
//
//    $ gcc timetest.c -o timetest -lasound
//
// Normal output looks something like this:

// 1.111173000 s
// 2.222449000 s
// 3.333687000 s
// 4.444934000 s
// 5.556152000 s
// 6.667393000 s
// 7.778598000 s
// 8.889843000 s

#include <stdio.h>
#include <unistd.h>
#include <alsa/asoundlib.h>

int main(void)
{
    snd_seq_t *seq;
    snd_seq_queue_status_t *status;
    const snd_seq_real_time_t *rt;
    int queue;
    int i;

    snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
    queue = snd_seq_alloc_named_queue(seq, "timetest");
    snd_seq_start_queue(seq, queue, NULL);
    snd_seq_drain_output(seq);
    snd_seq_queue_status_alloca(&status);

    for (i = 0; i < 10; i++) {
        // Sleep for a little over a second.
        usleep(1111111);

        snd_seq_get_queue_status(seq, queue, status);
        rt = snd_seq_queue_status_get_real_time(status);
        printf("%u.%09u s\n", rt->tv_sec, rt->tv_nsec);
    }

    snd_seq_close(seq);
    return 0;
}


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux