From: <tr...@ff...> - 2010-06-07 14:37:46
|
Author: jwoithe Date: 2010-06-07 07:37:38 -0700 (Mon, 07 Jun 2010) New Revision: 1847 Modified: trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp trunk/libffado/src/rme/rme_avdevice.cpp Log: RME: fix some streaming setup errors. Add debug output to assist with further development of the streaming interface. Modified: trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp =================================================================== --- trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp 2010-06-06 11:06:08 UTC (rev 1846) +++ trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp 2010-06-07 14:37:38 UTC (rev 1847) @@ -72,6 +72,9 @@ unsigned int RmeReceiveStreamProcessor::getMaxPacketSize() { int framerate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate(); + // FIXME: the additional 8 bytes is not needed. + // FIXME: the upper bounds of the 1x and 2x rates need to account for the + // DDS capability to run fast by 4%. if (m_rme_model == Rme::RME_MODEL_FIREFACE800) return 8 + (framerate<=48000?784:(framerate<=96000?1200:1200)); else @@ -106,7 +109,7 @@ uint32_t pkt_ctr) { // For testing -debugOutput(DEBUG_LEVEL_VERBOSE, "data packet header\n"); +debugOutput(DEBUG_LEVEL_VERBOSE, "data packet header, len=%d\n", length); if (length > 8) { // The iso data blocks from the RMEs comprise 24-bit audio @@ -128,8 +131,11 @@ // rest of the FFADO infrastructure. For now just take the current // value of the cycle timer as the "last timestamp". In practice // there a fixed offset that we'll have to include eventually. - m_last_timestamp = CYCLE_TIMER_TO_TICKS(m_Parent.get1394Service().getCycleTimer()); - +uint32_t ct = m_Parent.get1394Service().getCycleTimer(); +// m_last_timestamp = CYCLE_TIMER_TO_TICKS(ctm_Parent.get1394Service().getCycleTimer()); + m_last_timestamp = CYCLE_TIMER_TO_TICKS(ct); +debugOutput(DEBUG_LEVEL_VERBOSE, " timestamp: %lld, ct=%08x (%03ld,%04ld,%04ld)\n", m_last_timestamp, ct, + CYCLE_TIMER_GET_SECS(ct), CYCLE_TIMER_GET_CYCLES(ct), CYCLE_TIMER_GET_OFFSET(ct)); return eCRV_OK; } else { return eCRV_Invalid; @@ -150,7 +156,7 @@ enum StreamProcessor::eChildReturnValue RmeReceiveStreamProcessor::processPacketData(unsigned char *data, unsigned int length) { // m_event_size should never be zero - unsigned int n_events = (length-8) / m_event_size; + unsigned int n_events = length / m_event_size; // we have to keep in mind that there are also // some packets buffered by the ISO layer, @@ -167,7 +173,7 @@ #endif // For testing -debugOutput(DEBUG_LEVEL_VERBOSE, "data packet data\n"); +debugOutput(DEBUG_LEVEL_VERBOSE, "data packet data, length=%d, ev_size=%d, n_events=%d\n", length, m_event_size, n_events); if(m_data_buffer->writeFrames(n_events, (char *)data, m_last_timestamp)) { return eCRV_OK; Modified: trunk/libffado/src/rme/rme_avdevice.cpp =================================================================== --- trunk/libffado/src/rme/rme_avdevice.cpp 2010-06-06 11:06:08 UTC (rev 1846) +++ trunk/libffado/src/rme/rme_avdevice.cpp 2010-06-07 14:37:38 UTC (rev 1847) @@ -644,10 +644,12 @@ config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "recv_sp_dll_bw", recv_sp_dll_bw); config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "xmit_sp_dll_bw", xmit_sp_dll_bw); + // Calculate the event size. Each audio channel is allocated 4 bytes in + // the data stream. + /* FIXME: this will still require fine-tuning, but it's a start */ + signed int event_size = num_channels * 4; + // Set up receive stream processor, initialise it and set DLL bw - // TODO: set event_size properly; the value below is just a placeholder. - signed int event_size = 0x1000; - #warning event_size needs setting up m_receiveProcessor = new Streaming::RmeReceiveStreamProcessor(*this, m_rme_model, event_size); m_receiveProcessor->setVerboseLevel(getDebugLevel()); |