Package: libffado2                                                   
Version: 2.0.1+svn1856-5                                                        
                       
Severity: serious

The attached test program can trigger a (timing?) bug in libffado2,
which causes an assertion failure (i.e. crash of the whole
application).
#include <libffado/ffado.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>

enum {
    MAX_STREAMS = 16,
    PERIOD_SIZE = 1024,
    NB_BUFFERS = 3,
};

static float buffer[PERIOD_SIZE];

static bool
configure_stream(ffado_device_t *dev, int number)
{
    return ffado_streaming_set_playback_stream_buffer(dev, number, (char *)buffer) == 0 &&
        ffado_streaming_playback_stream_onoff(dev, number, 1) == 0;
}

int main(int argc, char **argv) {
    ffado_device_t *dev;

    ffado_device_info_t device_info;
    memset(&device_info, 0, sizeof(device_info));
    ffado_options_t options;
    memset(&options, 0, sizeof(options));
    options.sample_rate = 44100;
    options.period_size = PERIOD_SIZE;
    options.nb_buffers = NB_BUFFERS;
    options.verbose = 4;

    dev = ffado_streaming_init(device_info, options);
    assert(dev != NULL);

    ffado_streaming_set_audio_datatype(dev, ffado_audio_datatype_float);

    int num_streams = ffado_streaming_get_nb_playback_streams(dev);
    assert(num_streams > 0);

    int streams[MAX_STREAMS], configured_streams = 0;
    for (int i = 0; i < num_streams; ++i) {
        if (configured_streams >= 2)
            break;

        char name[256];
        ffado_streaming_get_playback_stream_name(dev, i, name,
                                                 sizeof(name) - 1);

        ffado_streaming_stream_type type =
            ffado_streaming_get_playback_stream_type(dev, i);
        if (type != ffado_stream_type_audio)
            continue;

        printf("stream %d name='%s'\n", i, name);

        streams[configured_streams++] = i;
        configure_stream(dev, i);
    }

    if (ffado_streaming_prepare(dev) != 0) {
        fprintf(stderr, "ffado_streaming_prepare() failed\n");
        return 1;
    }

    if (ffado_streaming_start(dev) != 0) {
        fprintf(stderr, "ffado_streaming_start() failed\n");
        return 1;
    }

    getchar();

    return 0;
}
Cannot create thread 1 Operation not permitted
ERROR: messagebuffer not initialized: 1250338856552:  (ffado.cpp)[  92] 
ffado_streaming_init: libffado 2.999.0- built Oct 16 2010 22:29:48
ERROR: messagebuffer not initialized: 1250338856611: Warning (ffado.cpp)[ 
121] ffado_streaming_init: Realtime scheduling is not enabled. This will cause 
significant reliability issues.
ERROR: messagebuffer not initialized: 1250339089620: Debug 
(devicemanager.cpp)[ 358] discover: Starting discovery...
ERROR: messagebuffer not initialized: 1250339197751: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339197771: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339197777: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339197783: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339197787: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339197791: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339197796: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized: 1250339197885: Debug (devicemanager.cpp)[ 
620] discover: driver found for device 0
ERROR: messagebuffer not initialized: 1250339218779: Debug 
(bebob_avdevice.cpp)[ 734] loadFromCache: filename 
/home/max/.ffado/cache/000d6c0b0076ee12/0000006001040403.xml
ERROR: messagebuffer not initialized: 1250339224945: Debug 
(serialize_libxml.cpp)[ 230] checkVersion: Cache version: 2.999.0-, expected: 
2.999.0-.
ERROR: messagebuffer not initialized: 1250339374980: Debug (avc_unit.cpp)[ 489] 
discoverPlugConnections: Discovering PCR plug connections...
ERROR: messagebuffer not initialized: 1250339412532: Debug (avc_unit.cpp)[ 500] 
discoverPlugConnections: Discovering External plug connections...
ERROR: messagebuffer not initialized: 1250339451864: Debug 
(bebob_avdevice_subunit.cpp)[ 102] discoverConnections: Discovering 
connections...
ERROR: messagebuffer not initialized: 1250339451876: Debug (avc_subunit.cpp)[ 
148] discoverConnections: Discovering connections...
ERROR: messagebuffer not initialized: 1250339451882: Debug (avc_subunit.cpp)[ 
148] discoverConnections: Discovering connections...
ERROR: messagebuffer not initialized: 1250339451885: Debug 
(bebob_avdevice_subunit.cpp)[ 102] discoverConnections: Discovering 
connections...
ERROR: messagebuffer not initialized: 1250339451888: Debug (avc_subunit.cpp)[ 
148] discoverConnections: Discovering connections...
ERROR: messagebuffer not initialized: 1250339451891: Debug (avc_subunit.cpp)[ 
148] discoverConnections: Discovering connections...
ERROR: messagebuffer not initialized: 1250339451904: Debug 
(bebob_avdevice.cpp)[ 758] loadFromCache: could create valid bebob driver from 
/home/max/.ffado/cache/000d6c0b0076ee12/0000006001040403.xml
ERROR: messagebuffer not initialized: 1250339453437: Debug (devicemanager.cpp)[ 
657] discover: discovery of node 0 on port 0 done...
ERROR: messagebuffer not initialized: 1250339453448: Debug (devicemanager.cpp)[ 
665] discover: Discovery finished...
ERROR: messagebuffer not initialized: 1250339453453: Debug 
(devicemanager.cpp)[1252] showDeviceInfo: ===== Device Manager =====
ERROR: messagebuffer not initialized: 1250339453458: Debug (Element.cpp)[ 121] 
show: Element DeviceManager
ERROR: messagebuffer not initialized: 1250339453461: Debug 
(devicemanager.cpp)[1260] showDeviceInfo: --- IEEE1394 Service  0 ---
ERROR: messagebuffer not initialized: Iso handler info:
ERROR: messagebuffer not initialized: Dumping IsoHandlerManager Stream handler 
information...
ERROR: messagebuffer not initialized:  State: 2
ERROR: messagebuffer not initialized: 1250339453478: Debug 
(devicemanager.cpp)[1270] showDeviceInfo: --- Device  0 ---
ERROR: messagebuffer not initialized: 1250339453482: Debug 
(bebob_avdevice.cpp)[ 480] showDevice: Device is a BeBoB device
ERROR: messagebuffer not initialized: 1250339453488: Debug (ffadodevice.cpp)[ 
214] showDevice: Attached to port.......: 0 (/dev/fw1)
ERROR: messagebuffer not initialized: 1250339453492: Debug (ffadodevice.cpp)[ 
215] showDevice: Node...................: 0
ERROR: messagebuffer not initialized: 1250339453496: Debug (ffadodevice.cpp)[ 
217] showDevice: Vendor name............: M-Audio
ERROR: messagebuffer not initialized: 1250339453500: Debug (ffadodevice.cpp)[ 
219] showDevice: Model name.............: FW Solo
ERROR: messagebuffer not initialized: 1250339453504: Debug (ffadodevice.cpp)[ 
221] showDevice: GUID...................: 000d6c0b0076ee12
ERROR: messagebuffer not initialized: 1250339453509: Debug (ffadodevice.cpp)[ 
226] showDevice: Assigned ID....: 000d6c0b0076ee12
ERROR: messagebuffer not initialized: 1250339453516: Debug 
(devicemanager.cpp)[1273] showDeviceInfo: Clock sync sources:
ERROR: messagebuffer not initialized: 1250339453526: Debug (avc_unit.cpp)[ 815] 
getActiveSyncInfo: Active Sync Connection: Internal (CSP), 'MSU Synch Output' 
-> 'MSU Synch Input'
ERROR: messagebuffer not initialized: 1250339453532: Debug (avc_unit.cpp)[ 815] 
getActiveSyncInfo: Active Sync Connection: Internal (CSP), 'MSU Synch Output' 
-> 'MSU Synch Input'
ERROR: messagebuffer not initialized: 1250339453542: Debug (avc_unit.cpp)[ 815] 
getActiveSyncInfo: Active Sync Connection: Internal (CSP), 'MSU Synch Output' 
-> 'MSU Synch Input'
ERROR: messagebuffer not initialized: 1250339453548: Debug 
(devicemanager.cpp)[1282] showDeviceInfo:  Type: Compound Syt Match, Id: 34, 
Valid: 1, Active: 0, Locked 1, Slipping: 0, Description: Syt Match
ERROR: messagebuffer not initialized: 1250339453552: Debug 
(devicemanager.cpp)[1282] showDeviceInfo:  Type: Internal          , Id: 31, 
Valid: 1, Active: 1, Locked 1, Slipping: 0, Description: Internal (CSP)
ERROR: messagebuffer not initialized: 1250339453557: Debug 
(devicemanager.cpp)[1282] showDeviceInfo:  Type: WordClock         , Id: 39, 
Valid: 1, Active: 0, Locked 1, Slipping: 0, Description: Ext Spdif Input
ERROR: messagebuffer not initialized: 1250339487137: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339487148: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339487153: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339487158: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339487162: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339487167: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339487171: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized: 1250339487203: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339487210: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339487214: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339487219: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339487222: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339487226: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339487230: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized: 1250339487260: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339487266: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339487270: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339487275: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339487279: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339487283: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339487286: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized: 1250339487310: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339487315: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339487320: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339487324: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339487328: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339487331: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339487335: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized: 1250339487364: Debug (Configuration.cpp)[ 
163] showSetting:   Group: (null)
ERROR: messagebuffer not initialized: 1250339487370: Debug (Configuration.cpp)[ 
185] showSetting:     vendorid = 3436 (0x00000D6C)
ERROR: messagebuffer not initialized: 1250339487374: Debug (Configuration.cpp)[ 
185] showSetting:     modelid = 65634 (0x00010062)
ERROR: messagebuffer not initialized: 1250339487379: Debug (Configuration.cpp)[ 
209] showSetting:     vendorname = M-Audio
ERROR: messagebuffer not initialized: 1250339487383: Debug (Configuration.cpp)[ 
209] showSetting:     modelname = FW Solo
ERROR: messagebuffer not initialized: 1250339487386: Debug (Configuration.cpp)[ 
185] showSetting:     driver = 1 (0x00000001)
ERROR: messagebuffer not initialized: 1250339487390: Debug (Configuration.cpp)[ 
185] showSetting:     xmit_max_cycles_early_transmit = 4 (0x00000004)
ERROR: messagebuffer not initialized:   Handler type................: Receive
ERROR: messagebuffer not initialized:   Port, Channel...............:  0,  0
ERROR: messagebuffer not initialized:   Buffer, MaxPacketSize, IRQ..:  128,  
200,   64
ERROR: messagebuffer not initialized:   Last cycle, dropped.........:   -1,    
0,    0
ERROR: messagebuffer not initialized:   Handler type................: Transmit
ERROR: messagebuffer not initialized:   Port, Channel...............:  0,  1
ERROR: messagebuffer not initialized:   Buffer, MaxPacketSize, IRQ..:  128,  
144,   64
ERROR: messagebuffer not initialized:   Speed ..................:  2
ERROR: messagebuffer not initialized:   Min ISOXMT bufferfill : 7999
ERROR: messagebuffer not initialized:   Last cycle, dropped.........:   -1,    
0,    0
ERROR: messagebuffer not initialized: 1250340177875: Warning 
(StreamProcessor.cpp)[ 707] getPacket: Instantanous samplerate more than 1% off 
nominal. [Nom fs: 44100.000000, Instantanous fs: 22051.144011, diff: 
22048.855989 (    0.499974)]
ERROR: messagebuffer not initialized: 1250340746132: Warning 
(TimestampedBuffer.cpp)[ 507] writeFrames: ringbuffer full, 128, 127
ERROR: messagebuffer not initialized: 1250340746144: Debug 
(StreamProcessor.cpp)[ 497] putPacket: processPacketData xrun
ERROR: messagebuffer not initialized: 1250340754077: Warning 
(StreamProcessor.cpp)[ 389] putPacket: Instantanous samplerate more than 1% off 
nominal. [Nom fs: 44100.000000, Instantanous fs:  1913.217792, diff: 
42186.782208 (    0.956616)]
ERROR: messagebuffer not initialized: 1250340754102: Warning 
(TimestampedBuffer.cpp)[1053] incrementFrameCounter: (0x7fc19002dba0) 
difference rather large (+): diff=    102800.632, max=      1536.000, 
1404404981.000, 1404302180.368
test: src/libutil/TimestampedBuffer.cpp:1029: void 
Util::TimestampedBuffer::incrementFrameCounter(unsigned int, 
ffado_timestamp_t): Assertion `nbframes == m_update_period' failed.
stream 0 name='000d6c0b0076ee12_SpdifOut L'
stream 1 name='000d6c0b0076ee12_SpdifOut R'

Reply via email to