Ticket #287: dice-restart.patch

File dice-restart.patch, 3.8 kB (added by adi, 2 years ago)
  • src/dice/dice_avdevice.cpp

    old new  
    11491149            return false; 
    11501150        } 
    11511151     
    1152         if (result != DICE_OWNER_NO_OWNER) { 
     1152        if (result != DICE_OWNER_NO_OWNER && result != swap_value) { 
    11531153            debugWarning("Could not register ourselves as device owner, unexpected register value: 0x%016"PRIX64"\n", result); 
    11541154            return false; 
    11551155        } 
     
    13041304            } 
    13051305            if(reg_isoch != 0xFFFFFFFFUL) { 
    13061306                debugError("ISO_CHANNEL register != 0xFFFFFFFF (=0x%08"PRIX32") for ATX %d\n", reg_isoch, n); 
    1307                 p->setChannel(-1); 
     1307                /* The ISO channel has already been registered, probably 
     1308                 * because the device was running before and jackd just 
     1309                 * crashed. Let's simply reuse the previously selected 
     1310                 * ISO channel. 
     1311                 * 
     1312                 * FIXME: try to reset the channel register and 
     1313                 * return to a clean state 
     1314                 */ 
    13081315                deallocateIsoChannel(isochannel); 
    1309                 return false; 
     1316                p->setChannel(reg_isoch); 
     1317#if 0 
     1318                /* FIXME: Looks like it's not necessary to ask the IRM. 
     1319                 * Just use the already registered ISO channel. 
     1320                 */ 
     1321                // ask the IRM to use this channel 
     1322                if (get1394Service().allocateFixedIsoChannelGeneric(reg_isoch,p->getMaxPacketSize()) < 0) { 
     1323                    debugError("Cannot allocate iso channel (0x%08"PRIX32") for ATX %d\n", reg_isoch, n);  
     1324                } 
     1325#endif 
     1326                isochannel=reg_isoch; 
    13101327            } 
    13111328     
    13121329            // write value of ISO_CHANNEL register 
     
    13551372            } 
    13561373            if(reg_isoch != 0xFFFFFFFFUL) { 
    13571374                debugError("ISO_CHANNEL register != 0xFFFFFFFF (=0x%08"PRIX32") for ARX %d\n", reg_isoch, n); 
    1358                 p->setChannel(-1); 
     1375                /* The ISO channel has already been registered, probably 
     1376                 * because the device was running before and jackd just 
     1377                 * crashed. Let's simply reuse the previously selected 
     1378                 * ISO channel. 
     1379                 * 
     1380                 * FIXME: try to reset the channel register and 
     1381                 * return to a clean state 
     1382                 */ 
    13591383                deallocateIsoChannel(isochannel); 
    1360                 return false; 
     1384                p->setChannel(reg_isoch); 
     1385#if 0 
     1386                /* FIXME: Looks like it's not necessary to ask the IRM. 
     1387                 * Just use the already registered ISO channel. 
     1388                 */ 
     1389                // ask the IRM to use this channel 
     1390                if (get1394Service().allocateFixedIsoChannelGeneric(reg_isoch,p->getMaxPacketSize()) < 0) { 
     1391                    debugError("Cannot allocate iso channel (0x%08"PRIX32") for ARX %d\n", reg_isoch, n);  
     1392                } 
     1393#endif 
     1394                isochannel=reg_isoch; 
    13611395            } 
    13621396     
    13631397            // write value of ISO_CHANNEL register 
     
    16901724        } 
    16911725    } 
    16921726 
     1727    // FIXME: after a crash, the device might still be streaming. We 
     1728    // simply force a stop now (unless in snoopMode) to return to a 
     1729    // clean state. 
     1730    bool snoopMode = false; 
     1731    if(!getOption("snoopMode", snoopMode)) { 
     1732        debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
     1733    } 
     1734 
     1735    if (!snoopMode) { 
     1736        disableIsoStreaming(); 
     1737    } 
     1738 
    16931739    debugOutput(DEBUG_LEVEL_VERBOSE,"DICE Parameter Space info:\n"); 
    16941740    debugOutput(DEBUG_LEVEL_VERBOSE," Global  : offset=%04X size=%04d\n", m_global_reg_offset, m_global_reg_size); 
    16951741    debugOutput(DEBUG_LEVEL_VERBOSE," TX      : offset=%04X size=%04d\n", m_tx_reg_offset, m_tx_reg_size);