Changeset 705
- Timestamp:
- 11/04/07 04:40:10 (16 years ago)
- Files:
-
- branches/ppalmers-streaming/src/bebob/bebob_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/bounce/bounce_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/bounce/bounce_slave_avdevice.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/devicemanager.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/dice/dice_avdevice.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/dice/dice_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/ffado_streaming.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/genericavc/avc_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpPort.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpPortInfo.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpSlaveStreamProcessor.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/AmdtpSlaveStreamProcessor.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpSlaveStreamProcessor.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/AmdtpSlaveStreamProcessor.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpStreamProcessor.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/AmdtpStreamProcessor.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpStreamProcessor.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/AmdtpStreamProcessor.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoStream.cpp)
- branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoStream.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/Port.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/Port.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/Port.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/Port.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/PortManager.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/PortManager.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/PortManager.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/PortManager.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/StreamProcessor.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/StreamProcessor.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/motu/MotuPort.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/motu/MotuPortInfo.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/motu/MotuPortInfo.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/motu/MotuStreamProcessor.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/motu/MotuStreamProcessor.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/cip.c (moved) (moved from branches/ppalmers-streaming/src/libstreaming/cip.c) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/cip.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/cip.h)
- branches/ppalmers-streaming/src/libstreaming/util/cycletimer.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/cycletimer.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/IsoHandler.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoHandler.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/IsoHandler.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoHandler.h) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.cpp (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoHandlerManager.cpp) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.h (moved) (moved from branches/ppalmers-streaming/src/libstreaming/IsoHandlerManager.h) (1 diff)
- branches/ppalmers-streaming/src/libutil/TimestampedBuffer.cpp (modified) (23 diffs)
- branches/ppalmers-streaming/src/libutil/TimestampedBuffer.h (modified) (3 diffs)
- branches/ppalmers-streaming/src/maudio/maudio_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/metrichalo/mh_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/motu/motu_avdevice.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/motu/motu_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/rme/rme_avdevice.h (modified) (1 diff)
- branches/ppalmers-streaming/src/SConscript (modified) (3 diffs)
- branches/ppalmers-streaming/tests/streaming/test-isohandling.cpp (modified) (1 diff)
- branches/ppalmers-streaming/tests/SytMonitor.cpp (modified) (1 diff)
- branches/ppalmers-streaming/tests/SytMonitor.h (modified) (1 diff)
- branches/ppalmers-streaming/tests/test-cycletimer.cpp (modified) (1 diff)
- branches/ppalmers-streaming/tests/test-sytmonitor.cpp (modified) (1 diff)
- branches/ppalmers-streaming/tests/test-timestampedbuffer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ppalmers-streaming/src/bebob/bebob_avdevice.h
r661 r705 42 42 #include "bebob/bebob_mixer.h" 43 43 44 #include "libstreaming/ AmdtpStreamProcessor.h"45 #include "libstreaming/ AmdtpPort.h"46 #include "libstreaming/ AmdtpPortInfo.h"44 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 45 #include "libstreaming/amdtp/AmdtpPort.h" 46 #include "libstreaming/amdtp/AmdtpPortInfo.h" 47 47 48 48 #include "libutil/serialize.h" branches/ppalmers-streaming/src/bounce/bounce_avdevice.h
r639 r705 30 30 #include "libavc/general/avc_extended_cmd_generic.h" 31 31 32 #include "libstreaming/ AmdtpStreamProcessor.h"33 #include "libstreaming/ AmdtpPort.h"34 #include "libstreaming/ AmdtpPortInfo.h"32 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 33 #include "libstreaming/amdtp/AmdtpPort.h" 34 #include "libstreaming/amdtp/AmdtpPortInfo.h" 35 35 36 36 #include "libieee1394/ARMHandler.h" branches/ppalmers-streaming/src/bounce/bounce_slave_avdevice.cpp
r587 r705 23 23 */ 24 24 25 #include "libstreaming/ AmdtpSlaveStreamProcessor.h"25 #include "libstreaming/amdtp/AmdtpSlaveStreamProcessor.h" 26 26 27 27 #include "libieee1394/configrom.h" branches/ppalmers-streaming/src/devicemanager.cpp
r674 r705 31 31 #include "libieee1394/ieee1394service.h" 32 32 33 #include "libstreaming/ StreamProcessor.h"33 #include "libstreaming/generic/StreamProcessor.h" 34 34 35 35 #include "debugmodule/debugmodule.h" branches/ppalmers-streaming/src/dice/dice_avdevice.cpp
r672 r705 28 28 #include "libieee1394/ieee1394service.h" 29 29 30 #include "libstreaming/ AmdtpStreamProcessor.h"30 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 31 31 32 32 #include "debugmodule/debugmodule.h" branches/ppalmers-streaming/src/dice/dice_avdevice.h
r639 r705 30 30 #include "libavc/avc_definitions.h" 31 31 32 #include "libstreaming/ AmdtpStreamProcessor.h"33 #include "libstreaming/ AmdtpPort.h"32 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 33 #include "libstreaming/amdtp/AmdtpPort.h" 34 34 #include "libieee1394/ARMHandler.h" 35 35 branches/ppalmers-streaming/src/ffado_streaming.cpp
r554 r705 76 76 } 77 77 78 dev->m_deviceManager->setVerboseLevel(DEBUG_LEVEL_ VERBOSE);78 dev->m_deviceManager->setVerboseLevel(DEBUG_LEVEL_NORMAL); 79 79 if ( !dev->m_deviceManager->initialize( dev->options.port ) ) { 80 80 debugFatal( "Could not initialize device manager\n" ); branches/ppalmers-streaming/src/genericavc/avc_avdevice.h
r639 r705 34 34 #include "libavc/general/avc_plug.h" 35 35 36 #include "libstreaming/ AmdtpStreamProcessor.h"37 #include "libstreaming/ AmdtpPort.h"38 #include "libstreaming/ AmdtpPortInfo.h"36 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 37 #include "libstreaming/amdtp/AmdtpPort.h" 38 #include "libstreaming/amdtp/AmdtpPortInfo.h" 39 39 40 40 #include "debugmodule/debugmodule.h" branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpPort.h
r703 r705 29 29 */ 30 30 31 #include " ../debugmodule/debugmodule.h"32 #include " Port.h"31 #include "debugmodule/debugmodule.h" 32 #include "../generic/Port.h" 33 33 #include "AmdtpPortInfo.h" 34 34 branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpPortInfo.h
r703 r705 25 25 #define __FFADO_AMDTPPORTINFO__ 26 26 27 #include " ../debugmodule/debugmodule.h"27 #include "debugmodule/debugmodule.h" 28 28 #include <string> 29 29 branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpSlaveStreamProcessor.cpp
r506 r705 24 24 #include "AmdtpSlaveStreamProcessor.h" 25 25 26 #include " cycletimer.h"26 #include "../util/cycletimer.h" 27 27 28 28 #include <netinet/in.h> branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpSlaveStreamProcessor.h
r445 r705 29 29 */ 30 30 #include "AmdtpStreamProcessor.h" 31 #include "../util/cip.h" 31 32 32 #include " ../debugmodule/debugmodule.h"33 #include "debugmodule/debugmodule.h" 33 34 34 #include "cip.h"35 35 #include <libiec61883/iec61883.h> 36 36 #include <pthread.h> branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpStreamProcessor.cpp
r703 r705 23 23 24 24 #include "AmdtpStreamProcessor.h" 25 #include "Port.h"26 25 #include "AmdtpPort.h" 27 26 28 #include " cycletimer.h"27 #include "../util/cycletimer.h" 29 28 30 29 #include <netinet/in.h> branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpStreamProcessor.h
r703 r705 29 29 */ 30 30 31 #include "../debugmodule/debugmodule.h" 32 #include "StreamProcessor.h" 33 34 #include "cip.h" 31 #include "debugmodule/debugmodule.h" 32 33 #include "../generic/StreamProcessor.h" 34 #include "../util/cip.h" 35 35 36 #include <libiec61883/iec61883.h> 36 37 #include <pthread.h> branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h
r445 r705 25 25 #define __FFADO_ISOSTREAM__ 26 26 27 #include "../util/IsoHandler.h" 28 29 #include "debugmodule/debugmodule.h" 30 27 31 #include <libraw1394/raw1394.h> 28 #include "../debugmodule/debugmodule.h"29 #include "IsoHandler.h"30 32 31 33 namespace Streaming branches/ppalmers-streaming/src/libstreaming/generic/Port.cpp
r554 r705 23 23 24 24 #include "Port.h" 25 25 26 #include <stdlib.h> 26 27 #include <assert.h> branches/ppalmers-streaming/src/libstreaming/generic/Port.h
r554 r705 25 25 #define __FFADO_PORT__ 26 26 27 #include "libutil/ringbuffer.h" 28 29 #include "debugmodule/debugmodule.h" 30 31 #include <string> 27 32 #include <stdint.h> 28 29 #include "../debugmodule/debugmodule.h"30 #include <string>31 #include "libutil/ringbuffer.h"32 33 33 34 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/generic/PortManager.cpp
r554 r705 24 24 #include "PortManager.h" 25 25 #include "Port.h" 26 26 27 #include <assert.h> 27 28 branches/ppalmers-streaming/src/libstreaming/generic/PortManager.h
r554 r705 25 25 #define __FFADO_PORTMANAGER__ 26 26 27 #include "../debugmodule/debugmodule.h"28 27 #include "Port.h" 28 29 #include "debugmodule/debugmodule.h" 29 30 30 31 #include <vector> branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp
r703 r705 22 22 */ 23 23 24 #include "StreamProcessor.h" 25 #include "../util/cycletimer.h" 26 #include "../StreamProcessorManager.h" 27 24 28 #include "libutil/Atomic.h" 25 26 #include "StreamProcessor.h"27 #include "StreamProcessorManager.h"28 #include "cycletimer.h"29 29 30 30 #include <assert.h> branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h
r703 r705 25 25 #define __FFADO_STREAMPROCESSOR__ 26 26 27 #include "../debugmodule/debugmodule.h"28 29 27 #include "IsoStream.h" 30 28 #include "PortManager.h" 31 32 #include <pthread.h>33 29 34 30 #include "libutil/StreamStatistics.h" 35 31 #include "libutil/TimestampedBuffer.h" 36 32 #include "libutil/OptionContainer.h" 33 34 #include "debugmodule/debugmodule.h" 35 36 #include <pthread.h> 37 37 38 38 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/motu/MotuPort.h
r703 r705 30 30 */ 31 31 32 #include "../debugmodule/debugmodule.h"33 #include "Port.h"34 32 #include "MotuPortInfo.h" 33 #include "../generic/Port.h" 34 35 #include "debugmodule/debugmodule.h" 35 36 36 37 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/motu/MotuPortInfo.cpp
r703 r705 24 24 25 25 #include "MotuPortInfo.h" 26 #include <assert.h>27 26 28 27 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/motu/MotuPortInfo.h
r703 r705 26 26 #define __FFADO_MOTUPORTINFO__ 27 27 28 #include " ../debugmodule/debugmodule.h"28 #include "debugmodule/debugmodule.h" 29 29 #include <string> 30 30 branches/ppalmers-streaming/src/libstreaming/motu/MotuStreamProcessor.cpp
r703 r705 24 24 25 25 #include "MotuStreamProcessor.h" 26 #include "Port.h"27 26 #include "MotuPort.h" 28 27 28 #include "../util/cycletimer.h" 29 29 30 #include <math.h> 30 31 31 #include <netinet/in.h> 32 33 #include "cycletimer.h"34 32 35 33 // in ticks branches/ppalmers-streaming/src/libstreaming/motu/MotuStreamProcessor.h
r703 r705 25 25 #ifndef __FFADO_MOTUSTREAMPROCESSOR__ 26 26 #define __FFADO_MOTUSTREAMPROCESSOR__ 27 28 #include "../generic/StreamProcessor.h" 29 30 #include "libutil/DelayLockedLoop.h" 31 #include "debugmodule/debugmodule.h" 32 27 33 #include <assert.h> 28 29 #include "../debugmodule/debugmodule.h"30 #include "StreamProcessor.h"31 32 #include "../libutil/DelayLockedLoop.h"33 34 34 35 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp
r703 r705 23 23 24 24 #include "StreamProcessorManager.h" 25 #include "StreamProcessor.h" 26 #include "Port.h" 25 #include "generic/StreamProcessor.h" 26 #include "generic/Port.h" 27 #include "util/cycletimer.h" 28 27 29 #include <errno.h> 28 30 #include <assert.h> 29 30 #include "libstreaming/cycletimer.h"31 31 32 32 #define CYCLES_TO_SLEEP_AFTER_RUN_SIGNAL 5 branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.h
r703 r705 25 25 #define __FFADO_STREAMPROCESSORMANAGER__ 26 26 27 #include "generic/Port.h" 28 #include "generic/StreamProcessor.h" 29 #include "util/IsoHandlerManager.h" 30 27 31 #include "debugmodule/debugmodule.h" 28 32 #include "libutil/Thread.h" 29 33 #include "libutil/OptionContainer.h" 30 #include <semaphore.h>31 #include "Port.h"32 #include "StreamProcessor.h"33 #include "IsoHandlerManager.h"34 34 35 35 #include <vector> 36 #include <semaphore.h> 36 37 37 38 namespace Streaming { branches/ppalmers-streaming/src/libstreaming/util/cip.c
r386 r705 19 19 */ 20 20 21 #include "cip.h" 22 23 #include <netinet/in.h> 21 24 #include <libiec61883/iec61883.h> 22 #include "cip.h"23 24 #include <netinet/in.h>25 25 26 26 branches/ppalmers-streaming/src/libstreaming/util/cycletimer.h
r703 r705 27 27 #define __CYCLETIMER_H__ 28 28 29 #include "debugmodule/debugmodule.h" 30 29 31 #include <inttypes.h> 30 #include "debugmodule/debugmodule.h"31 32 32 33 #define CSR_CYCLE_TIME 0x200 branches/ppalmers-streaming/src/libstreaming/util/IsoHandler.cpp
r679 r705 23 23 24 24 #include "IsoHandler.h" 25 #include "IsoStream.h"26 25 #include "cycletimer.h" 26 #include "../generic/IsoStream.h" 27 27 28 28 #include "libutil/TimeSource.h" branches/ppalmers-streaming/src/libstreaming/util/IsoHandler.h
r445 r705 25 25 #define __FFADO_ISOHANDLER__ 26 26 27 #include " ../debugmodule/debugmodule.h"27 #include "debugmodule/debugmodule.h" 28 28 29 29 #include <libraw1394/raw1394.h> branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.cpp
r703 r705 24 24 #include "IsoHandlerManager.h" 25 25 #include "IsoHandler.h" 26 #include "IsoStream.h" 26 #include "../generic/IsoStream.h" 27 28 #include "libutil/PosixThread.h" 29 27 30 #include <assert.h> 28 29 #include "../libutil/PosixThread.h"30 31 31 32 32 #define MINIMUM_INTERRUPTS_PER_PERIOD 2U branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.h
r703 r705 25 25 #define __FFADO_ISOHANDLERMANAGER__ 26 26 27 #include "../debugmodule/debugmodule.h" 28 #include "../libutil/Thread.h" 27 #include "debugmodule/debugmodule.h" 28 29 #include "libutil/Thread.h" 29 30 30 31 #include <sys/poll.h> branches/ppalmers-streaming/src/libutil/TimestampedBuffer.cpp
r512 r705 28 28 29 29 #include "libutil/Atomic.h" 30 #include "libstreaming/ cycletimer.h"30 #include "libstreaming/util/cycletimer.h" 31 31 32 32 #include "TimestampedBuffer.h" … … 45 45 #define DLL_COEFF_C (DLL_OMEGA * DLL_OMEGA) 46 46 47 #define ENTER_CRITICAL_SECTION { \ 48 pthread_mutex_lock(&m_framecounter_lock); \ 49 } 50 #define EXIT_CRITICAL_SECTION { \ 51 pthread_mutex_unlock(&m_framecounter_lock); \ 52 } 53 47 54 namespace Util { 48 55 … … 53 60 m_event_size(0), m_events_per_frame(0), m_buffer_size(0), 54 61 m_bytes_per_frame(0), m_bytes_per_buffer(0), 62 m_enabled( false ), m_transparent ( true ), 55 63 m_wrap_at(0xFFFFFFFFFFFFFFFFLLU), 56 64 m_Client(c), m_framecounter(0), … … 122 130 ffado_timestamp_t diff; 123 131 124 pthread_mutex_lock(&m_framecounter_lock);132 ENTER_CRITICAL_SECTION; 125 133 diff=m_buffer_next_tail_timestamp - m_buffer_tail_timestamp; 126 pthread_mutex_unlock(&m_framecounter_lock);134 EXIT_CRITICAL_SECTION; 127 135 128 136 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"getRate: %f/%f=%f\n", … … 208 216 // of the new offset. Doing so certainly makes for a smoother MOTU 209 217 // startup. 210 pthread_mutex_lock(&m_framecounter_lock);218 ENTER_CRITICAL_SECTION; 211 219 m_buffer_tail_timestamp = m_buffer_tail_timestamp - m_tick_offset + nticks; 212 220 m_buffer_next_tail_timestamp = (ffado_timestamp_t)((double)m_buffer_tail_timestamp + m_dll_e2); 213 221 m_tick_offset=nticks; 214 pthread_mutex_unlock(&m_framecounter_lock);222 EXIT_CRITICAL_SECTION; 215 223 216 224 return true; … … 225 233 * 226 234 * In order to get the number of frames in the buffer, use the 227 * get FrameCounter, getBufferHeadTimestamp, getBufferTailTimestamp235 * getBufferHeadTimestamp, getBufferTailTimestamp 228 236 * functions 229 237 * … … 348 356 349 357 // increment without updating the DLL 350 pthread_mutex_lock(&m_framecounter_lock);358 ENTER_CRITICAL_SECTION; 351 359 m_framecounter++; 352 pthread_mutex_unlock(&m_framecounter_lock);360 EXIT_CRITICAL_SECTION; 353 361 354 362 return true; … … 370 378 unsigned int write_size=nframes*m_event_size*m_events_per_frame; 371 379 372 // add the data payload to the ringbuffer 373 if (ffado_ringbuffer_write(m_event_buffer,data,write_size) < write_size) 374 { 375 // debugWarning("writeFrames buffer overrun\n"); 376 return false; 377 } 378 379 incrementFrameCounter(nframes,ts); 380 381 return true; 382 383 } 380 if (m_transparent) { 381 // // if the buffer is disabled, it's in a 'transparent' state, meaning 382 // // that if too much is put into the buffer, the oldest data is discarded 383 // signed int fc; 384 // ENTER_CRITICAL_SECTION; 385 // fc=m_framecounter; 386 // EXIT_CRITICAL_SECTION; 387 // 388 // signed int frames_to_ditch= nframes - (m_buffer_size - m_framecounter) + 1; 389 // if ( frames_to_ditch > 0 ) { 390 // debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "dropping %d frames\n", frames_to_ditch); 391 // dropFrames( frames_to_ditch ); 392 // } 393 // // add the data payload to the ringbuffer 394 // if (ffado_ringbuffer_write(m_event_buffer,data,write_size) < write_size) 395 // { 396 // debugError("we should have freed up enough space for this\n"); 397 // return false; 398 // } 399 // 400 // while disabled, we don't update the DLL, we just set the correct 401 // timestamp for the frames 402 setBufferTailTimestamp(ts); 403 } else { 404 // add the data payload to the ringbuffer 405 if (ffado_ringbuffer_write(m_event_buffer,data,write_size) < write_size) 406 { 407 return false; 408 } 409 incrementFrameCounter(nframes,ts); 410 } 411 return true; 412 } 413 414 /** 415 * @brief Drop frames from the head of the buffer 416 * 417 * drops \ref nframes of frames from the head of internal buffer 418 * 419 * @param nframes number of frames to drop 420 * @return true if successful 421 */ 422 bool TimestampedBuffer::dropFrames(unsigned int nframes) { 423 424 unsigned int read_size=nframes*m_event_size*m_events_per_frame; 425 426 ffado_ringbuffer_read_advance(m_event_buffer, read_size); 427 decrementFrameCounter(nframes); 428 429 return true; 430 } 431 384 432 /** 385 433 * @brief Read frames from the buffer … … 651 699 #endif 652 700 653 pthread_mutex_lock(&m_framecounter_lock);701 ENTER_CRITICAL_SECTION; 654 702 655 703 m_buffer_tail_timestamp = ts; … … 658 706 m_buffer_next_tail_timestamp = (ffado_timestamp_t)((double)m_buffer_tail_timestamp + m_dll_e2); 659 707 660 pthread_mutex_unlock(&m_framecounter_lock);661 662 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, " Set buffer tail timestampfor (%p) to "708 EXIT_CRITICAL_SECTION; 709 710 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "for (%p) to " 663 711 TIMESTAMP_FORMAT_SPEC" => "TIMESTAMP_FORMAT_SPEC", NTS=" 664 712 TIMESTAMP_FORMAT_SPEC", DLL2=%f, RATE=%f\n", 665 this, new_timestamp, ts, m_buffer_next_tail_timestamp, m_dll_e2, m_nominal_rate);713 this, new_timestamp, ts, m_buffer_next_tail_timestamp, m_dll_e2, getRate()); 666 714 667 715 } … … 689 737 ffado_timestamp_t ts=new_timestamp; 690 738 691 pthread_mutex_lock(&m_framecounter_lock);739 ENTER_CRITICAL_SECTION; 692 740 693 741 // add the time … … 705 753 m_buffer_next_tail_timestamp = (ffado_timestamp_t)((double)m_buffer_tail_timestamp + m_dll_e2); 706 754 707 pthread_mutex_unlock(&m_framecounter_lock);708 709 debugOutput(DEBUG_LEVEL_VER Y_VERBOSE, "Set buffer head timestampfor (%p) to "TIMESTAMP_FORMAT_SPEC" => "755 EXIT_CRITICAL_SECTION; 756 757 debugOutput(DEBUG_LEVEL_VERBOSE, "for (%p) to "TIMESTAMP_FORMAT_SPEC" => " 710 758 TIMESTAMP_FORMAT_SPEC", NTS="TIMESTAMP_FORMAT_SPEC", DLL2=%f, RATE=%f\n", 711 this, new_timestamp, ts, m_buffer_next_tail_timestamp, m_dll_e2, m_nominal_rate);759 this, new_timestamp, ts, m_buffer_next_tail_timestamp, m_dll_e2, getRate()); 712 760 713 761 } … … 741 789 */ 742 790 void TimestampedBuffer::getBufferTailTimestamp(ffado_timestamp_t *ts, signed int *fc) { 743 pthread_mutex_lock(&m_framecounter_lock);791 ENTER_CRITICAL_SECTION; 744 792 *fc = m_framecounter; 745 793 *ts = m_buffer_tail_timestamp; 746 pthread_mutex_unlock(&m_framecounter_lock);794 EXIT_CRITICAL_SECTION; 747 795 } 748 796 … … 764 812 ffado_timestamp_t timestamp; 765 813 766 pthread_mutex_lock(&m_framecounter_lock);767 814 ENTER_CRITICAL_SECTION; 815 768 816 diff=m_buffer_next_tail_timestamp - m_buffer_tail_timestamp; 769 817 timestamp=m_buffer_tail_timestamp; 770 818 771 pthread_mutex_unlock(&m_framecounter_lock);819 EXIT_CRITICAL_SECTION; 772 820 773 821 if (diff < 0) diff += m_wrap_at; … … 804 852 */ 805 853 void TimestampedBuffer::resetFrameCounter() { 806 pthread_mutex_lock(&m_framecounter_lock);854 ENTER_CRITICAL_SECTION; 807 855 m_framecounter = 0; 808 pthread_mutex_unlock(&m_framecounter_lock);856 EXIT_CRITICAL_SECTION; 809 857 } 810 858 … … 815 863 */ 816 864 void TimestampedBuffer::decrementFrameCounter(int nbframes) { 817 pthread_mutex_lock(&m_framecounter_lock);865 ENTER_CRITICAL_SECTION; 818 866 m_framecounter -= nbframes; 819 pthread_mutex_unlock(&m_framecounter_lock);867 EXIT_CRITICAL_SECTION; 820 868 } 821 869 … … 835 883 ffado_timestamp_t diff; 836 884 837 pthread_mutex_lock(&m_framecounter_lock);885 ENTER_CRITICAL_SECTION; 838 886 diff=m_buffer_next_tail_timestamp - m_buffer_tail_timestamp; 839 pthread_mutex_unlock(&m_framecounter_lock);887 EXIT_CRITICAL_SECTION; 840 888 841 889 if (diff < 0) diff += m_wrap_at; … … 854 902 } 855 903 856 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer tail timestamp for (%p) to "857 TIMESTAMP_FORMAT_SPEC" => "TIMESTAMP_FORMAT_SPEC"\n",858 this, new_timestamp, ts);859 860 904 #ifdef DEBUG 861 905 if (new_timestamp >= m_wrap_at) { 862 debugWarning("timestamp not wrapped: "TIMESTAMP_FORMAT_SPEC"\n", new_timestamp);906 debugWarning("timestamp not wrapped: "TIMESTAMP_FORMAT_SPEC"\n", new_timestamp); 863 907 } 864 908 if ((ts >= m_wrap_at) || (ts < 0 )) { … … 868 912 // FIXME: JMW: at some points during startup the timestamp doesn't change. 869 913 // This still needs to be verified in more detail. 870 if (ts>m_buffer_tail_timestamp-1 && ts<m_buffer_tail_timestamp+1) {871 pthread_mutex_lock(&m_framecounter_lock);872 m_framecounter += nbframes;873 pthread_mutex_unlock(&m_framecounter_lock);874 return;875 }914 // if (ts>m_buffer_tail_timestamp-1 && ts<m_buffer_tail_timestamp+1) { 915 // ENTER_CRITICAL_SECTION; 916 // m_framecounter += nbframes; 917 // EXIT_CRITICAL_SECTION; 918 // return; 919 // } 876 920 877 921 // update the DLL 878 pthread_mutex_lock(&m_framecounter_lock);922 ENTER_CRITICAL_SECTION; 879 923 diff = ts-m_buffer_next_tail_timestamp; 880 pthread_mutex_unlock(&m_framecounter_lock); 881 882 #ifdef DEBUG 883 if ((diff > ((ffado_timestamp_t)1000)) || (diff < ((ffado_timestamp_t)-1000))) { 884 debugWarning("(%p) difference rather large: "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 885 this, diff, ts, m_buffer_next_tail_timestamp); 886 } 887 #endif 924 EXIT_CRITICAL_SECTION; 925 926 // check whether the update is within the allowed bounds 927 const float max_deviation = (100.0/100.0); // maximal relative difference considered normal 928 ffado_timestamp_t expected_difference=m_update_period * getRate(); 929 ffado_timestamp_t max_abs_diff = expected_difference * max_deviation; 930 931 if (diff > max_abs_diff) { 932 debugWarning("(%p) difference rather large (+): diff="TIMESTAMP_FORMAT_SPEC", expected="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 933 this, diff, expected_difference, ts, m_buffer_next_tail_timestamp); 934 // debugShowBackLogLines(40); 935 936 // we can limit the difference 937 // we can't discard it because that would prevent us from tracking the samplerate 938 diff = max_abs_diff; 939 940 } else if (diff < -max_abs_diff) { 941 debugWarning("(%p) difference rather large (-): diff="TIMESTAMP_FORMAT_SPEC", expected="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 942 this, diff, expected_difference, ts, m_buffer_next_tail_timestamp); 943 // debugShowBackLogLines(40); 944 945 // we can limit the difference 946 // we can't discard it because that would prevent us from tracking the samplerate 947 diff = -max_abs_diff; 948 } 888 949 889 950 // idea to implement it for nbframes values that differ from m_update_period: … … 895 956 896 957 // the maximal difference we can allow (64secs) 897 const ffado_timestamp_t max=m_wrap_at/2;898 899 if(diff > max) {900 diff -= m_wrap_at;901 } else if (diff < -max) {902 diff += m_wrap_at;903 }904 905 floaterr=diff;958 // const ffado_timestamp_t max=m_wrap_at/2; 959 // 960 // if(diff > max) { 961 // diff -= m_wrap_at; 962 // } else if (diff < -max) { 963 // diff += m_wrap_at; 964 // } 965 966 double err=diff; 906 967 907 968 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "diff2="TIMESTAMP_FORMAT_SPEC" err=%f\n", … … 910 971 m_framecounter, m_buffer_tail_timestamp, m_buffer_next_tail_timestamp); 911 972 912 pthread_mutex_lock(&m_framecounter_lock);973 ENTER_CRITICAL_SECTION; 913 974 m_framecounter += nbframes; 914 975 … … 919 980 920 981 m_dll_e2 += m_dll_c*err; 921 922 // debugOutputShort(DEBUG_LEVEL_VERBOSE, "%p %llu %lld %llu %llu %e %e\n", this, new_timestamp, diff, m_buffer_tail_timestamp, m_buffer_next_tail_timestamp, m_dll_e2, 24576000.0/getRate()); 982 983 EXIT_CRITICAL_SECTION; 984 985 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "tail for (%p) to " 986 TIMESTAMP_FORMAT_SPEC" => "TIMESTAMP_FORMAT_SPEC", NTS=" 987 TIMESTAMP_FORMAT_SPEC", DLL2=%f, RATE=%f\n", 988 this, new_timestamp, ts, m_buffer_next_tail_timestamp, m_dll_e2, getRate()); 923 989 924 990 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "U: FC=%10u, TS="TIMESTAMP_FORMAT_SPEC", NTS="TIMESTAMP_FORMAT_SPEC"\n", 925 991 m_framecounter, m_buffer_tail_timestamp, m_buffer_next_tail_timestamp); 926 992 993 ENTER_CRITICAL_SECTION; 927 994 if (m_buffer_next_tail_timestamp >= m_wrap_at) { 928 995 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Unwrapping next tail timestamp: "TIMESTAMP_FORMAT_SPEC"", … … 935 1002 936 1003 } 1004 EXIT_CRITICAL_SECTION; 937 1005 938 1006 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "A: TS="TIMESTAMP_FORMAT_SPEC", NTS="TIMESTAMP_FORMAT_SPEC", DLLe2=%f, RATE=%f\n", 939 1007 m_buffer_tail_timestamp, m_buffer_next_tail_timestamp, m_dll_e2, rate); 940 1008 941 pthread_mutex_unlock(&m_framecounter_lock);942 1009 943 1010 if(m_buffer_tail_timestamp>=m_wrap_at) { branches/ppalmers-streaming/src/libutil/TimestampedBuffer.h
r554 r705 92 92 TimestampedBuffer(TimestampedBufferClient *); 93 93 virtual ~TimestampedBuffer(); 94 94 95 95 bool writeDummyFrame(); 96 96 bool dropFrames(unsigned int nbframes); 97 97 98 bool writeFrames(unsigned int nbframes, char *data, ffado_timestamp_t ts); 98 99 bool readFrames(unsigned int nbframes, char *data); … … 104 105 bool prepare(); 105 106 bool reset(); 107 108 bool isEnabled() {return m_enabled;}; 109 void enable() {m_enabled=true;}; 110 void disable() {m_enabled=false;}; 111 112 bool isTransparent() {return m_transparent;}; 113 void setTransparent(bool v) {m_transparent=v;}; 106 114 107 115 bool setEventSize(unsigned int s); … … 160 168 unsigned int m_bytes_per_frame; 161 169 unsigned int m_bytes_per_buffer; 170 bool m_enabled; // you can get frames FIXME: rename!! 171 bool m_transparent; // the buffer should hold the frames put in it. if true, discards all frames 162 172 163 173 ffado_timestamp_t m_wrap_at; // value to wrap at branches/ppalmers-streaming/src/maudio/maudio_avdevice.h
r583 r705 32 32 #include "bebob/bebob_avdevice.h" 33 33 34 #include "libstreaming/ AmdtpStreamProcessor.h"35 #include "libstreaming/ AmdtpPort.h"36 #include "libstreaming/ AmdtpPortInfo.h"34 #include "libstreaming/amdtp/AmdtpStreamProcessor.h" 35 #include "libstreaming/amdtp/AmdtpPort.h" 36 #include "libstreaming/amdtp/AmdtpPortInfo.h" 37 37 38 38 #include "ffadodevice.h" branches/ppalmers-streaming/src/metrichalo/mh_avdevice.h
r639 r705 30 30 #include "libavc/avc_definitions.h" 31 31 32 // #include "libstreaming/ MHStreamProcessor.h"32 // #include "libstreaming/mh/MHStreamProcessor.h" 33 33 34 34 class ConfigRom; branches/ppalmers-streaming/src/motu/motu_avdevice.cpp
r660 r705 32 32 #include "debugmodule/debugmodule.h" 33 33 34 #include "libstreaming/ MotuStreamProcessor.h"35 #include "libstreaming/ MotuPort.h"34 #include "libstreaming/motu/MotuStreamProcessor.h" 35 #include "libstreaming/motu/MotuPort.h" 36 36 37 37 #include "libutil/DelayLockedLoop.h" branches/ppalmers-streaming/src/motu/motu_avdevice.h
r660 r705 31 31 #include "libavc/avc_definitions.h" 32 32 33 #include "libstreaming/ MotuStreamProcessor.h"33 #include "libstreaming/motu/MotuStreamProcessor.h" 34 34 35 35 #define MOTUFW_BASE_ADDR 0xfffff0000000ULL branches/ppalmers-streaming/src/rme/rme_avdevice.h
r639 r705 31 31 #include "libavc/avc_definitions.h" 32 32 33 // #include "libstreaming/ RmeStreamProcessor.h"33 // #include "libstreaming/rme/RmeStreamProcessor.h" 34 34 35 35 class ConfigRom; branches/ppalmers-streaming/src/SConscript
r688 r705 48 48 libosc/OscResponse.cpp \ 49 49 libosc/OscServer.cpp \ 50 libstreaming/cip.c \51 libstreaming/IsoHandler.cpp \52 libstreaming/IsoHandlerManager.cpp \53 libstreaming/IsoStream.cpp \54 libstreaming/Port.cpp \55 libstreaming/PortManager.cpp \56 libstreaming/StreamProcessor.cpp \57 50 libstreaming/StreamProcessorManager.cpp \ 51 libstreaming/util/cip.c \ 52 libstreaming/util/IsoHandler.cpp \ 53 libstreaming/util/IsoHandlerManager.cpp \ 54 libstreaming/generic/StreamProcessor.cpp \ 55 libstreaming/generic/IsoStream.cpp \ 56 libstreaming/generic/Port.cpp \ 57 libstreaming/generic/PortManager.cpp \ 58 58 libutil/cmd_serialize.cpp \ 59 59 libutil/DelayLockedLoop.cpp \ … … 127 127 motu_source = env.Split( '\ 128 128 motu/motu_avdevice.cpp \ 129 libstreaming/ MotuPort.cpp \130 libstreaming/ MotuPortInfo.cpp \131 libstreaming/ MotuStreamProcessor.cpp \129 libstreaming/motu/MotuPort.cpp \ 130 libstreaming/motu/MotuPortInfo.cpp \ 131 libstreaming/motu/MotuStreamProcessor.cpp \ 132 132 ' ) 133 133 … … 151 151 152 152 amdtp_source = env.Split( '\ 153 libstreaming/ AmdtpPort.cpp \154 libstreaming/ AmdtpPortInfo.cpp \155 libstreaming/ AmdtpStreamProcessor.cpp \153 libstreaming/amdtp/AmdtpPort.cpp \ 154 libstreaming/amdtp/AmdtpPortInfo.cpp \ 155 libstreaming/amdtp/AmdtpStreamProcessor.cpp \ 156 156 ' ) 157 157 branches/ppalmers-streaming/tests/streaming/test-isohandling.cpp
r445 r705 35 35 #include <netinet/in.h> 36 36 37 #include "src/libstreaming/IsoHandler.h"38 #include "src/libstreaming/IsoStream.h"39 #include "src/libstreaming/StreamProcessorManager.h"40 #include "src/libstreaming/AmdtpStreamProcessor.h"41 #include "src/libstreaming/IsoHandlerManager.h"42 37 #include "src/libutil/PosixThread.h" 43 #include "src/libstreaming/AmdtpPort.h" 38 39 #include "src/libstreaming/util/IsoHandler.h" 40 #include "src/libstreaming/util/StreamProcessorManager.h" 41 #include "src/libstreaming/util/IsoHandlerManager.h" 42 #include "src/libstreaming/amdtp/AmdtpStreamProcessor.h" 43 #include "src/libstreaming/amdtp/AmdtpPort.h" 44 44 45 45 using namespace Streaming; 46 47 46 48 47 int run; branches/ppalmers-streaming/tests/SytMonitor.cpp
r445 r705 24 24 25 25 #include "SytMonitor.h" 26 #include "src/libstreaming/IsoStream.h"27 26 28 27 #include <netinet/in.h> branches/ppalmers-streaming/tests/SytMonitor.h
r445 r705 25 25 #ifndef __FFADO_SYTMONITOR__ 26 26 #define __FFADO_SYTMONITOR__ 27 #include "src/libstreaming/ IsoStream.h"28 #include "src/libstreaming/ cip.h"29 #include "src/libstreaming/ cycletimer.h"27 #include "src/libstreaming/generic/IsoStream.h" 28 #include "src/libstreaming/util/cip.h" 29 #include "src/libstreaming/util/cycletimer.h" 30 30 #include "src/libutil/ringbuffer.h" 31 31 branches/ppalmers-streaming/tests/test-cycletimer.cpp
r445 r705 37 37 #include <netinet/in.h> 38 38 39 #include "src/libstreaming/ cycletimer.h"40 41 #include "src/libstreaming/ IsoHandler.h"42 #include "src/libstreaming/ IsoStream.h"43 #include "src/libstreaming/ IsoHandlerManager.h"39 #include "src/libstreaming/util/cycletimer.h" 40 41 #include "src/libstreaming/util/IsoHandler.h" 42 #include "src/libstreaming/generic/IsoStream.h" 43 #include "src/libstreaming/util/IsoHandlerManager.h" 44 44 #include "src/libutil/PosixThread.h" 45 45 branches/ppalmers-streaming/tests/test-sytmonitor.cpp
r445 r705 37 37 #include <netinet/in.h> 38 38 39 #include "src/libstreaming/ cycletimer.h"40 41 #include "src/libstreaming/ IsoHandlerManager.h"39 #include "src/libstreaming/util/cycletimer.h" 40 41 #include "src/libstreaming/util/IsoHandlerManager.h" 42 42 #include "SytMonitor.h" 43 43 branches/ppalmers-streaming/tests/test-timestampedbuffer.cpp
r494 r705 37 37 #include <netinet/in.h> 38 38 39 #include "src/libstreaming/ cycletimer.h"39 #include "src/libstreaming/util/cycletimer.h" 40 40 41 41 #include "src/libutil/TimestampedBuffer.h"