Changeset 391
- Timestamp:
- 02/09/07 00:01:30 (16 years ago)
- Files:
-
- branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp (modified) (34 diffs)
- branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h (modified) (4 diffs)
- branches/streaming-rework/src/libstreaming/IsoHandler.cpp (modified) (1 diff)
- branches/streaming-rework/src/libstreaming/IsoHandler.h (modified) (1 diff)
- branches/streaming-rework/src/libstreaming/IsoHandlerManager.cpp (modified) (2 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessor.cpp (modified) (10 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessor.h (modified) (9 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessorManager.cpp (modified) (3 diffs)
- branches/streaming-rework/src/libutil/TimestampedBuffer.cpp (added)
- branches/streaming-rework/src/libutil/TimestampedBuffer.h (added)
- branches/streaming-rework/src/Makefile.am (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp
r390 r391 53 53 /* transmit */ 54 54 AmdtpTransmitStreamProcessor::AmdtpTransmitStreamProcessor(int port, int framerate, int dimension) 55 : TransmitStreamProcessor(port, framerate), m_dimension(dimension) 56 , m_last_timestamp(0), m_dbc(0), m_ringbuffer_size_frames(0) 57 { 58 55 : TransmitStreamProcessor(port, framerate), m_dimension(dimension) 56 , m_last_timestamp(0), m_dbc(0), m_ringbuffer_size_frames(0) 57 { 59 58 60 59 } 61 60 62 61 AmdtpTransmitStreamProcessor::~AmdtpTransmitStreamProcessor() { 63 freebob_ringbuffer_free(m_event_buffer); 64 free(m_cluster_buffer); 62 65 63 } 66 64 … … 95 93 unsigned int nevents=0; 96 94 95 m_last_cycle=cycle; 96 97 97 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Xmit handler for cycle %d, (running=%d, enabled=%d,%d)\n", 98 98 cycle, m_running, m_disabled, m_is_disabled); … … 124 124 uint64_t fc; 125 125 126 getBufferTailTimestamp(&ts_tail, &fc); // thread safe126 m_data_buffer->getBufferTailTimestamp(&ts_tail, &fc); // thread safe 127 127 128 128 int64_t timestamp = ts_tail; … … 134 134 135 135 // FIXME: test 136 // substract the receive transfer delay 137 timestamp -= RECEIVE_PROCESSING_DELAY; 136 // timestamp -= (uint64_t)(((float)m_handler->getWakeupInterval()) 137 // * ((float)m_syt_interval) * ticks_per_frame); 138 // 139 // // substract the receive transfer delay 140 // timestamp -= RECEIVE_PROCESSING_DELAY; 138 141 139 142 // this happens if m_buffer_tail_timestamp wraps around while there are … … 268 271 debugOutput(DEBUG_LEVEL_VERBOSE,"Preparing to enable...\n"); 269 272 270 m_SyncSource->getBufferHeadTimestamp(&ts, &fc); // thread safe 271 273 m_SyncSource->m_data_buffer->getBufferHeadTimestamp(&ts, &fc); // thread safe 274 275 // the number of cycles the sync source lags 276 // or leads (< 0) 277 int sync_lag_cycles=cycle-m_SyncSource->getLastCycle()-1; 278 if(sync_lag_cycles > (int)(CYCLES_PER_SECOND/2)) { 279 sync_lag_cycles -= CYCLES_PER_SECOND/2; 280 } 281 if (sync_lag_cycles < -((int)CYCLES_PER_SECOND/2)) { 282 sync_lag_cycles += CYCLES_PER_SECOND/2; 283 } 284 272 285 // recalculate the buffer head timestamp 273 286 float ticks_per_frame=m_SyncSource->getTicksPerFrame(); … … 278 291 // plus one frame 279 292 ts += (uint64_t)ticks_per_frame; 293 294 // account for the cycle lag between sync SP and this SP 295 ts += sync_lag_cycles * TICKS_PER_CYCLE; 296 280 297 if (ts >= TICKS_PER_SECOND * 128L) { 281 298 ts -= TICKS_PER_SECOND * 128L; 282 299 } 283 284 300 301 // m_data_buffer->setBufferHeadTimestamp(ts); 285 302 int64_t timestamp = ts; 286 303 … … 289 306 // frames_in_buffer * rate 290 307 // later 291 int frames_in_buffer= getFrameCounter();308 int frames_in_buffer=m_data_buffer->getFrameCounter(); 292 309 timestamp += (int64_t)((float)frames_in_buffer * ticks_per_frame); 293 310 … … 302 319 } 303 320 304 StreamProcessor::setBufferTailTimestamp(timestamp);321 m_data_buffer->setBufferTailTimestamp(timestamp); 305 322 306 323 debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT TS SET: TS=%10lld, TSTMP=%10llu, FC=%4d, %f\n", … … 349 366 *tag = IEC61883_TAG_WITH_CIP; 350 367 *sy = 0; 351 352 unsigned int read_size=nevents*sizeof(quadlet_t)*m_dimension; 353 354 if ((freebob_ringbuffer_read(m_event_buffer,(char *)(data+8),read_size)) < 355 read_size) 368 369 if (m_data_buffer->readFrames(nevents, (char *)(data + 8))) 356 370 { 371 *length = nevents*sizeof(quadlet_t)*m_dimension + 8; 372 373 // process all ports that should be handled on a per-packet base 374 // this is MIDI for AMDTP (due to the need of DBC) 375 if (!encodePacketPorts((quadlet_t *)(data+8), nevents, packet->dbc)) { 376 debugWarning("Problem encoding Packet Ports\n"); 377 } 378 379 packet->fdf = m_fdf; 380 381 // convert the timestamp to SYT format 382 uint64_t ts=timestamp + TRANSMIT_TRANSFER_DELAY; 383 384 // check if it wrapped 385 if (ts >= TICKS_PER_SECOND * 128L) { 386 ts -= TICKS_PER_SECOND * 128L; 387 } 388 389 unsigned int timestamp_SYT = TICKS_TO_SYT(ts); 390 packet->syt = ntohs(timestamp_SYT); 391 392 // update the frame counter such that it reflects the new value 393 // done in the SP base class 394 if (!StreamProcessor::getFrames(nevents)) { 395 debugError("Could not do StreamProcessor::getFrames(%d)\n",nevents); 396 return RAW1394_ISO_ERROR; 397 } 398 399 return RAW1394_ISO_OK; 400 } else { 357 401 /* there is no more data in the ringbuffer */ 358 402 // convert the timestamp to SYT format … … 392 436 393 437 return RAW1394_ISO_DEFER; 394 } else {395 *length = read_size + 8;396 397 // process all ports that should be handled on a per-packet base398 // this is MIDI for AMDTP (due to the need of DBC)399 if (!encodePacketPorts((quadlet_t *)(data+8), nevents, packet->dbc)) {400 debugWarning("Problem encoding Packet Ports\n");401 }402 403 packet->fdf = m_fdf;404 405 // convert the timestamp to SYT format406 uint64_t ts=timestamp + TRANSMIT_TRANSFER_DELAY;407 408 // check if it wrapped409 if (ts >= TICKS_PER_SECOND * 128L) {410 ts -= TICKS_PER_SECOND * 128L;411 }412 413 unsigned int timestamp_SYT = TICKS_TO_SYT(ts);414 packet->syt = ntohs(timestamp_SYT);415 416 // calculate the new buffer head timestamp. this is417 // the previous buffer head timestamp plus418 // the number of frames sent * ticks_per_frame419 timestamp += (int64_t)((float)nevents * ticks_per_frame );420 421 // check if it wrapped422 if (timestamp >= TICKS_PER_SECOND * 128L) {423 timestamp -= TICKS_PER_SECOND * 128L;424 }425 426 // update the frame counter such that it reflects the new value427 // also update the buffer head timestamp428 // done in the SP base class429 if (!StreamProcessor::getFrames(nevents, timestamp)) {430 debugError("Could not do StreamProcessor::getFrames(%d, %llu)\n",nevents, timestamp);431 return RAW1394_ISO_ERROR;432 }433 434 return RAW1394_ISO_OK;435 438 } 436 439 … … 470 473 uint64_t ts; 471 474 uint64_t fc; 472 m_SyncSource-> getBufferHeadTimestamp(&ts, &fc); // thread safe475 m_SyncSource->m_data_buffer->getBufferHeadTimestamp(&ts, &fc); // thread safe 473 476 474 477 // update the frame counter such that it reflects the buffer content, … … 476 479 // done in the SP base class 477 480 if (!StreamProcessor::putFrames(m_ringbuffer_size_frames, ts)) { 478 debugError("Could not do StreamProcessor::putFrames(%d, %0 )\n",479 m_ringbuffer_size_frames );481 debugError("Could not do StreamProcessor::putFrames(%d, %011llu)\n", 482 m_ringbuffer_size_frames,ts); 480 483 return false; 481 484 } … … 488 491 debugOutput( DEBUG_LEVEL_VERBOSE, "Resetting...\n"); 489 492 490 // reset the event buffer, discard all content491 freebob_ringbuffer_reset(m_event_buffer);492 493 493 // reset the statistics 494 494 m_PeriodStat.reset(); … … 566 566 m_syt_interval); 567 567 568 // prepare the framerate estimate 569 m_ticks_per_frame = (TICKS_PER_SECOND*1.0) / ((float)m_framerate); 570 568 571 // allocate the event buffer 569 572 m_ringbuffer_size_frames=m_nb_buffers * m_period; 570 571 // prepare the framerate estimate 572 m_ticks_per_frame = (TICKS_PER_SECOND*1.0) / ((float)m_framerate); 573 573 574 574 // add the receive processing delay 575 575 // m_ringbuffer_size_frames+=(uint)(RECEIVE_PROCESSING_DELAY/m_ticks_per_frame); 576 577 if( !(m_event_buffer=freebob_ringbuffer_create( 578 (m_dimension * m_ringbuffer_size_frames) * sizeof(quadlet_t)))) { 579 debugFatal("Could not allocate memory event ringbuffer"); 580 return false; 581 } 582 583 // allocate the temporary cluster buffer 584 if( !(m_cluster_buffer=(char *)calloc(m_dimension,sizeof(quadlet_t)))) { 585 debugFatal("Could not allocate temporary cluster buffer"); 586 freebob_ringbuffer_free(m_event_buffer); 587 return false; 588 } 576 577 assert(m_data_buffer); 578 m_data_buffer->setBufferSize(m_ringbuffer_size_frames); 579 m_data_buffer->setEventSize(sizeof(quadlet_t)); 580 m_data_buffer->setEventsPerFrame(m_dimension); 581 582 m_data_buffer->setUpdatePeriod(m_period); 583 m_data_buffer->setNominalRate(m_ticks_per_frame); 584 585 m_data_buffer->prepare(); 589 586 590 587 // set the parameters of ports we can: … … 685 682 686 683 // prefill the event buffer 687 if (!prefill()) { 688 debugFatal("Could not prefill buffers\n"); 689 return false; 690 } 684 // NOTE: do we need to prefill? reset() is called, so everything is prefilled then 685 // if (!prefill()) { 686 // debugFatal("Could not prefill buffers\n"); 687 // return false; 688 // } 691 689 692 690 debugOutput( DEBUG_LEVEL_VERBOSE, "Prepared for:\n"); … … 724 722 } 725 723 726 bool AmdtpTransmitStreamProcessor::transferSilence(unsigned int size) { 727 /* a naive implementation would look like this: */ 728 729 unsigned int write_size=size*sizeof(quadlet_t)*m_dimension; 730 char *dummybuffer=(char *)calloc(sizeof(quadlet_t),size*m_dimension); 731 transmitSilenceBlock(dummybuffer, size, 0); 732 733 if (freebob_ringbuffer_write(m_event_buffer,(char *)(dummybuffer),write_size) < write_size) { 724 bool AmdtpTransmitStreamProcessor::transferSilence(unsigned int nframes) { 725 bool retval; 726 727 char *dummybuffer=(char *)calloc(sizeof(quadlet_t),nframes*m_dimension); 728 729 transmitSilenceBlock(dummybuffer, nframes, 0); 730 731 // add the silence data to the ringbuffer 732 if(m_data_buffer->writeFrames(nframes, dummybuffer)) { 733 retval=true; 734 } else { 734 735 debugWarning("Could not write to event buffer\n"); 735 } 736 736 retval=false; 737 } 738 737 739 free(dummybuffer); 738 740 739 return true;741 return retval; 740 742 } 741 743 742 744 bool AmdtpTransmitStreamProcessor::canClientTransferFrames(unsigned int nbframes) { 743 745 // there has to be enough space to put the frames in 744 return m_ringbuffer_size_frames - getFrameCounter() > nbframes;746 return m_ringbuffer_size_frames - m_data_buffer->getFrameCounter() > nbframes; 745 747 } 746 748 747 749 bool AmdtpTransmitStreamProcessor::putFrames(unsigned int nbframes, int64_t ts) { 748 m_PeriodStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 749 750 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Transferring period...\n"); 751 int xrun; 752 unsigned int offset=0; 750 m_PeriodStat.mark(m_data_buffer->getBufferFill()); 753 751 754 752 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "AmdtpTransmitStreamProcessor::putFrames(%d, %llu)\n",nbframes, ts); 755 753 756 freebob_ringbuffer_data_t vec[2]; 757 // we received one period of frames 758 // this is period_size*dimension of events 759 unsigned int events2write=nbframes*m_dimension; 760 unsigned int bytes2write=events2write*sizeof(quadlet_t); 761 762 /* write events2write bytes to the ringbuffer 763 * first see if it can be done in one read. 764 * if so, ok. 765 * otherwise write up to a multiple of clusters directly to the buffer 766 * then do the buffer wrap around using ringbuffer_write 767 * then write the remaining data directly to the buffer in a third pass 768 * Make sure that we cannot end up on a non-cluster aligned position! 769 */ 770 unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 771 772 while(bytes2write>0) { 773 int byteswritten=0; 774 775 unsigned int frameswritten=(nbframes*cluster_size-bytes2write)/cluster_size; 776 offset=frameswritten; 777 778 freebob_ringbuffer_get_write_vector(m_event_buffer, vec); 779 780 if(vec[0].len==0) { // this indicates a full event buffer 781 debugError("XMT: Event buffer overrun in processor %p\n",this); 782 break; 783 } 784 785 /* if we don't take care we will get stuck in an infinite loop 786 * because we align to a cluster boundary later 787 * the remaining nb of bytes in one write operation can be 788 * smaller than one cluster 789 * this can happen because the ringbuffer size is always a power of 2 790 */ 791 if(vec[0].len<cluster_size) { 792 793 // encode to the temporary buffer 794 xrun = transmitBlock(m_cluster_buffer, 1, offset); 795 796 if(xrun<0) { 797 // xrun detected 798 debugError("XMT: Frame buffer underrun in processor %p\n",this); 799 break; 800 } 801 802 // use the ringbuffer function to write one cluster 803 // the write function handles the wrap around. 804 freebob_ringbuffer_write(m_event_buffer, 805 m_cluster_buffer, 806 cluster_size); 807 808 // we advanced one cluster_size 809 bytes2write-=cluster_size; 810 811 } else { // 812 813 if(bytes2write>vec[0].len) { 814 // align to a cluster boundary 815 byteswritten=vec[0].len-(vec[0].len%cluster_size); 816 } else { 817 byteswritten=bytes2write; 818 } 819 820 xrun = transmitBlock(vec[0].buf, 821 byteswritten/cluster_size, 822 offset); 823 824 if(xrun<0) { 825 // xrun detected 826 debugError("XMT: Frame buffer underrun in processor %p\n",this); 827 break; // FIXME: return false ? 828 } 829 830 freebob_ringbuffer_write_advance(m_event_buffer, byteswritten); 831 bytes2write -= byteswritten; 832 } 833 834 // the bytes2write should always be cluster aligned 835 assert(bytes2write%cluster_size==0); 836 837 } 754 m_data_buffer->blockProcessWriteFrames(nbframes, ts); 838 755 839 756 // recalculate the buffer tail timestamp … … 878 795 */ 879 796 880 int AmdtpTransmitStreamProcessor::transmitBlock(char *data,797 bool AmdtpTransmitStreamProcessor::processWriteBlock(char *data, 881 798 unsigned int nevents, unsigned int offset) 882 799 { 883 int problem=0;800 bool no_problem=true; 884 801 885 802 for ( PortVectorIterator it = m_PeriodPorts.begin(); … … 899 816 if(encodePortToMBLAEvents(static_cast<AmdtpAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 900 817 debugWarning("Could not encode port %s to MBLA events",(*it)->getName().c_str()); 901 problem=1;818 no_problem=false; 902 819 } 903 820 break; … … 908 825 } 909 826 } 910 return problem;827 return no_problem; 911 828 912 829 } … … 1090 1007 : ReceiveStreamProcessor(port, framerate), m_dimension(dimension), m_last_timestamp(0), m_last_timestamp2(0) { 1091 1008 1092 1093 1009 } 1094 1010 1095 1011 AmdtpReceiveStreamProcessor::~AmdtpReceiveStreamProcessor() { 1096 freebob_ringbuffer_free(m_event_buffer);1097 free(m_cluster_buffer);1098 1012 1099 1013 } 1100 1014 1101 1015 bool AmdtpReceiveStreamProcessor::init() { 1016 1102 1017 // call the parent init 1103 1018 // this has to be done before allocating the buffers, … … 1117 1032 1118 1033 enum raw1394_iso_disposition retval=RAW1394_ISO_OK; 1034 m_last_cycle=cycle; 1119 1035 1120 1036 struct iec61883_packet *packet = (struct iec61883_packet *) data; … … 1144 1060 channel, cycle,syt_timestamp, 1145 1061 CYCLE_TIMER_GET_CYCLES(syt_timestamp), CYCLE_TIMER_GET_OFFSET(syt_timestamp), 1146 getFrameCounter(), m_is_disabled);1062 m_data_buffer->getFrameCounter(), m_is_disabled); 1147 1063 1148 1064 // reconstruct the full cycle … … 1199 1115 // we have to keep in mind that there are also 1200 1116 // some packets buffered by the ISO layer 1201 // at most x=m_handler->get NbBuffers()1117 // at most x=m_handler->getWakeupInterval() 1202 1118 // these contain at most x*syt_interval 1203 1119 // frames, meaning that we might receive 1204 1120 // this packet x*syt_interval*ticks_per_frame 1205 1121 // later than expected (the real receive time) 1206 m_last_timestamp += (uint64_t)(((float)m_handler->getNbBuffers()) 1207 * m_syt_interval * m_ticks_per_frame); 1122 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"STMP: %lluticks | buff=%d, syt_interval=%d, tpf=%f\n", 1123 m_last_timestamp, m_handler->getWakeupInterval(),m_syt_interval,m_ticks_per_frame); 1124 1125 m_last_timestamp += (uint64_t)(((float)m_handler->getWakeupInterval()) 1126 * ((float)m_syt_interval) * m_ticks_per_frame); 1127 debugOutput(DEBUG_LEVEL_VERY_VERBOSE," ==> %lluticks\n", m_last_timestamp); 1208 1128 1209 1129 // the receive processing delay indicates how much 1210 1130 // extra time we need as slack 1211 1131 m_last_timestamp += RECEIVE_PROCESSING_DELAY; 1212 1132 1133 // wrap if nescessary 1134 if (m_last_timestamp >= TICKS_PER_SECOND * 128L) { 1135 m_last_timestamp -= TICKS_PER_SECOND * 128L; 1136 } 1137 1213 1138 //=> now estimate the device frame rate 1214 1139 if (m_last_timestamp2 && m_last_timestamp) { … … 1271 1196 m_is_disabled=false; 1272 1197 debugOutput(DEBUG_LEVEL_VERBOSE,"enabling StreamProcessor %p at %d\n", this, cycle); 1198 // the previous timestamp is the one we need to start with 1199 // because we're going to update the buffer again this loop 1200 m_data_buffer->setBufferTailTimestamp(m_last_timestamp2); 1201 1273 1202 } else { 1274 1203 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"will enable StreamProcessor %p at %u, now is %d\n", this, m_cycle_to_enable_at, cycle); … … 1296 1225 } 1297 1226 // set the timestamps 1298 StreamProcessor::setBufferTimestamps(ts,ts);1227 m_data_buffer->setBufferTailTimestamp(ts); 1299 1228 1300 1229 return RAW1394_ISO_DEFER; … … 1302 1231 1303 1232 //=> process the packet 1304 unsigned int write_size=nevents*sizeof(quadlet_t)*m_dimension;1305 1306 1233 // add the data payload to the ringbuffer 1307 if (freebob_ringbuffer_write(m_event_buffer,(char *)(data+8),write_size) < write_size) 1308 { 1309 debugWarning("Receive buffer overrun (cycle %d, FC=%d, PC=%d)\n", 1310 cycle, getFrameCounter(), m_handler->getPacketCount()); 1311 1312 m_xruns++; 1313 1314 // disable the processing, will be re-enabled when 1315 // the xrun is handled 1316 m_disabled=true; 1317 m_is_disabled=true; 1318 1319 retval=RAW1394_ISO_DEFER; 1320 } else { 1234 if(m_data_buffer->writeFrames(nevents, (char *)(data+8))) { 1321 1235 retval=RAW1394_ISO_OK; 1236 1322 1237 // process all ports that should be handled on a per-packet base 1323 1238 // this is MIDI for AMDTP (due to the need of DBC) … … 1326 1241 retval=RAW1394_ISO_DEFER; 1327 1242 } 1243 1244 } else { 1245 1246 debugWarning("Receive buffer overrun (cycle %d, FC=%d, PC=%d)\n", 1247 cycle, m_data_buffer->getFrameCounter(), m_handler->getPacketCount()); 1248 1249 m_xruns++; 1250 1251 // disable the processing, will be re-enabled when 1252 // the xrun is handled 1253 m_disabled=true; 1254 m_is_disabled=true; 1255 1256 retval=RAW1394_ISO_DEFER; 1257 1328 1258 } 1329 1259 … … 1434 1364 // currently this is in ticks 1435 1365 1436 int64_t fc= getFrameCounter();1366 int64_t fc=m_data_buffer->getFrameCounter(); 1437 1367 1438 1368 int64_t next_period_boundary = m_last_timestamp; … … 1483 1413 } 1484 1414 1485 1486 1415 bool AmdtpReceiveStreamProcessor::reset() { 1487 1416 1488 1417 debugOutput( DEBUG_LEVEL_VERBOSE, "Resetting...\n"); 1489 1418 1490 // reset the event buffer, discard all content1491 freebob_ringbuffer_reset(m_event_buffer);1492 1493 1419 m_PeriodStat.reset(); 1494 1420 m_PacketStat.reset(); … … 1562 1488 ringbuffer_size_frames+=(uint)(RECEIVE_PROCESSING_DELAY/m_ticks_per_frame); 1563 1489 1564 if( !(m_event_buffer=freebob_ringbuffer_create( 1565 (m_dimension * ringbuffer_size_frames) * sizeof(quadlet_t)))) { 1566 debugFatal("Could not allocate memory event ringbuffer"); 1567 return false; 1568 } 1569 1570 // allocate the temporary cluster buffer 1571 if( !(m_cluster_buffer=(char *)calloc(m_dimension,sizeof(quadlet_t)))) { 1572 debugFatal("Could not allocate temporary cluster buffer"); 1573 freebob_ringbuffer_free(m_event_buffer); 1574 return false; 1575 } 1490 assert(m_data_buffer); 1491 m_data_buffer->setBufferSize(ringbuffer_size_frames); 1492 m_data_buffer->setEventSize(sizeof(quadlet_t)); 1493 m_data_buffer->setEventsPerFrame(m_dimension); 1494 1495 // the buffer is written every syt_interval 1496 m_data_buffer->setUpdatePeriod(m_syt_interval); 1497 m_data_buffer->setNominalRate(m_ticks_per_frame); 1498 1499 m_data_buffer->prepare(); 1576 1500 1577 1501 // set the parameters of ports we can: … … 1671 1595 1672 1596 bool AmdtpReceiveStreamProcessor::canClientTransferFrames(unsigned int nbframes) { 1673 return getFrameCounter() >= (int) nbframes; 1674 } 1675 1676 bool AmdtpReceiveStreamProcessor::getFrames(unsigned int nbframes, int64_t ts) { 1677 1678 m_PeriodStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 1679 1680 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Transferring period...\n"); 1681 1682 int xrun; 1683 unsigned int offset=0; 1684 1685 freebob_ringbuffer_data_t vec[2]; 1686 // we received one period of frames on each connection 1687 // this is period_size*dimension of events 1688 1689 unsigned int events2read=nbframes*m_dimension; 1690 unsigned int bytes2read=events2read*sizeof(quadlet_t); 1691 /* read events2read bytes from the ringbuffer 1692 * first see if it can be done in one read. 1693 * if so, ok. 1694 * otherwise read up to a multiple of clusters directly from the buffer 1695 * then do the buffer wrap around using ringbuffer_read 1696 * then read the remaining data directly from the buffer in a third pass 1697 * Make sure that we cannot end up on a non-cluster aligned position! 1698 */ 1699 unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 1700 1701 while(bytes2read>0) { 1702 unsigned int framesread=(nbframes*cluster_size-bytes2read)/cluster_size; 1703 offset=framesread; 1704 1705 int bytesread=0; 1706 1707 freebob_ringbuffer_get_read_vector(m_event_buffer, vec); 1708 1709 if(vec[0].len==0) { // this indicates an empty event buffer 1710 debugError("RCV: Event buffer underrun in processor %p\n",this); 1711 break; 1712 } 1713 1714 /* if we don't take care we will get stuck in an infinite loop 1715 * because we align to a cluster boundary later 1716 * the remaining nb of bytes in one read operation can be smaller than one cluster 1717 * this can happen because the ringbuffer size is always a power of 2 1718 */ 1719 if(vec[0].len<cluster_size) { 1720 // use the ringbuffer function to read one cluster 1721 // the read function handles wrap around 1722 freebob_ringbuffer_read(m_event_buffer,m_cluster_buffer,cluster_size); 1723 1724 xrun = receiveBlock(m_cluster_buffer, 1, offset); 1725 1726 if(xrun<0) { 1727 // xrun detected 1728 debugError("RCV: Frame buffer overrun in processor %p\n",this); 1729 break; 1730 } 1731 1732 // we advanced one cluster_size 1733 bytes2read-=cluster_size; 1734 1735 } else { // 1736 1737 if(bytes2read>vec[0].len) { 1738 // align to a cluster boundary 1739 bytesread=vec[0].len-(vec[0].len%cluster_size); 1740 } else { 1741 bytesread=bytes2read; 1742 } 1743 1744 xrun = receiveBlock(vec[0].buf, bytesread/cluster_size, offset); 1745 1746 if(xrun<0) { 1747 // xrun detected 1748 debugError("RCV: Frame buffer overrun in processor %p\n",this); 1749 break; 1750 } 1751 1752 freebob_ringbuffer_read_advance(m_event_buffer, bytesread); 1753 bytes2read -= bytesread; 1754 } 1755 1756 // the bytes2read should always be cluster aligned 1757 assert(bytes2read%cluster_size==0); 1758 } 1597 return m_data_buffer->getFrameCounter() >= (int) nbframes; 1598 } 1599 1600 bool AmdtpReceiveStreamProcessor::getFrames(unsigned int nbframes) { 1601 1602 m_PeriodStat.mark(m_data_buffer->getBufferFill()); 1603 1604 // ask the buffer to process nbframes of frames 1605 // using it's registered client's processReadBlock(), 1606 // which should be ours 1607 m_data_buffer->blockProcessReadFrames(nbframes); 1759 1608 1760 1609 // update the frame counter such that it reflects the new value, 1761 // and also update the buffer head timestamp as we pull frames1762 1610 // done in the SP base class 1763 1764 // wrap the timestamp if nescessary 1765 if (ts < 0) { 1766 ts += TICKS_PER_SECOND * 128L; 1767 } else if (ts >= TICKS_PER_SECOND * 128L) { 1768 ts -= TICKS_PER_SECOND * 128L; 1769 } 1770 1771 if (!StreamProcessor::getFrames(nbframes, ts)) { 1772 debugError("Could not do StreamProcessor::getFrames(%d, %llu)\n", nbframes, ts); 1611 1612 if (!StreamProcessor::getFrames(nbframes)) { 1613 debugError("Could not do StreamProcessor::getFrames(%d)\n", nbframes); 1773 1614 return false; 1774 1615 } … … 1780 1621 * \brief write received events to the stream ringbuffers. 1781 1622 */ 1782 int AmdtpReceiveStreamProcessor::receiveBlock(char *data,1623 bool AmdtpReceiveStreamProcessor::processReadBlock(char *data, 1783 1624 unsigned int nevents, unsigned int offset) 1784 1625 { 1785 int problem=0; 1626 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "(%p)->processReadBlock(%u, %u)\n",this,nevents,offset); 1627 1628 bool no_problem=true; 1786 1629 1787 1630 for ( PortVectorIterator it = m_PeriodPorts.begin(); … … 1801 1644 if(decodeMBLAEventsToPort(static_cast<AmdtpAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 1802 1645 debugWarning("Could not decode packet MBLA to port %s",(*it)->getName().c_str()); 1803 problem=1;1646 no_problem=false; 1804 1647 } 1805 1648 break; … … 1813 1656 } 1814 1657 } 1815 returnproblem;1658 return no_problem; 1816 1659 1817 1660 } branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h
r386 r391 35 35 #include "../debugmodule/debugmodule.h" 36 36 #include "StreamProcessor.h" 37 37 38 #include "cip.h" 38 39 #include <libiec61883/iec61883.h> 39 #include "libutil/ringbuffer.h"40 40 #include <pthread.h> 41 41 … … 117 117 118 118 protected: 119 bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset); 119 120 120 121 struct iec61883_cip m_cip_status; 121 122 freebob_ringbuffer_t * m_event_buffer; 123 char* m_cluster_buffer; 122 124 123 int m_dimension; 125 124 unsigned int m_syt_interval; … … 184 183 185 184 bool canClientTransferFrames(unsigned int nbframes); 186 bool getFrames(unsigned int nbframes , int64_t ts); ///< transfer the buffer contents to the client185 bool getFrames(unsigned int nbframes); ///< transfer the buffer contents to the client 187 186 188 187 // We have 1 period of samples = m_period … … 208 207 protected: 209 208 210 int receiveBlock(char *data, unsigned int nevents, unsigned int offset); 209 bool processReadBlock(char *data, unsigned int nevents, unsigned int offset); 210 211 211 bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc); 212 212 213 213 int decodeMBLAEventsToPort(AmdtpAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents); 214 214 215 freebob_ringbuffer_t * m_event_buffer;216 char* m_cluster_buffer;217 215 int m_dimension; 218 216 unsigned int m_syt_interval; branches/streaming-rework/src/libstreaming/IsoHandler.cpp
r390 r391 134 134 135 135 if (m_TimeSource) delete m_TimeSource; 136 } 137 138 bool IsoHandler::iterate() { 139 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "IsoHandler (%p) iterate...\n",this); 140 141 if(m_handle) { 142 if(raw1394_loop_iterate(m_handle)) { 143 debugOutput( DEBUG_LEVEL_VERBOSE, 144 "IsoHandler (%p): Failed to iterate handler: %s\n", 145 this,strerror(errno)); 146 return false; 147 } else { 148 return true; 149 } 150 } else { 151 return false; 152 } 136 153 } 137 154 branches/streaming-rework/src/libstreaming/IsoHandler.h
r390 r391 72 72 virtual bool stop(); 73 73 74 int iterate() { if(m_handle) return raw1394_loop_iterate(m_handle); else return -1; };74 bool iterate(); 75 75 76 76 void setVerboseLevel(int l); branches/streaming-rework/src/libstreaming/IsoHandlerManager.cpp
r390 r391 45 45 IsoHandlerManager::IsoHandlerManager() : 46 46 m_State(E_Created), 47 m_poll_timeout(1 ), m_poll_fds(0), m_poll_nfds(0),47 m_poll_timeout(100), m_poll_fds(0), m_poll_nfds(0), 48 48 m_realtime(false), m_priority(0) 49 49 { … … 323 323 unsigned int packets_per_period=stream->getPacketsPerPeriod(); 324 324 325 #if 1325 #if 0 326 326 // hardware interrupts occur when one DMA block is full, and the size of one DMA 327 327 // block = PAGE_SIZE. Setting the max_packet_size makes sure that the HW irq is branches/streaming-rework/src/libstreaming/StreamProcessor.cpp
r390 r391 52 52 , m_is_disabled(true) 53 53 , m_cycle_to_enable_at(0) 54 , m_framecounter(0)55 54 , m_SyncSource(NULL) 56 55 , m_ticks_per_frame(0) 57 56 { 57 // create the timestamped buffer and register ourselves as its client 58 m_data_buffer=new FreebobUtil::TimestampedBuffer(this); 58 59 59 60 } 60 61 61 62 StreamProcessor::~StreamProcessor() { 62 63 if (m_data_buffer) delete m_data_buffer; 63 64 } 64 65 65 66 void StreamProcessor::dumpInfo() 66 67 { 67 int64_t diff=(int64_t)m_buffer_head_timestamp - (int64_t)m_buffer_tail_timestamp;68 69 68 debugOutputShort( DEBUG_LEVEL_NORMAL, " StreamProcessor information\n"); 70 69 debugOutputShort( DEBUG_LEVEL_NORMAL, " Iso stream info:\n"); … … 72 71 IsoStream::dumpInfo(); 73 72 debugOutputShort( DEBUG_LEVEL_NORMAL, " StreamProcessor info:\n"); 74 debugOutputShort( DEBUG_LEVEL_NORMAL, " Frame counter : %d\n", m_framecounter);75 debugOutputShort( DEBUG_LEVEL_NORMAL, " Buffer head timestamp : %011llu\n",m_buffer_head_timestamp);76 debugOutputShort( DEBUG_LEVEL_NORMAL, " Buffer tail timestamp : %011llu\n",m_buffer_tail_timestamp);77 debugOutputShort( DEBUG_LEVEL_NORMAL, " Head - Tail : %011lld\n",diff);78 73 debugOutputShort( DEBUG_LEVEL_NORMAL, " Now : %011u\n",m_handler->getCycleTimerTicks()); 79 74 debugOutputShort( DEBUG_LEVEL_NORMAL, " Xruns : %d\n", m_xruns); … … 82 77 debugOutputShort( DEBUG_LEVEL_NORMAL, " enable status : %s\n", m_is_disabled ? "No" : "Yes"); 83 78 79 m_data_buffer->dumpInfo(); 80 84 81 // m_PeriodStat.dumpInfo(); 85 82 // m_PacketStat.dumpInfo(); … … 92 89 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "enter...\n"); 93 90 94 pthread_mutex_init(&m_framecounter_lock, NULL);95 91 m_data_buffer->init(); 92 96 93 return IsoStream::init(); 97 94 } … … 105 102 debugOutput( DEBUG_LEVEL_VERBOSE, "Resetting...\n"); 106 103 107 resetFrameCounter(); 108 104 // reset the event buffer, discard all content 105 if (!m_data_buffer->reset()) { 106 debugFatal("Could not reset data buffer\n"); 107 return false; 108 } 109 109 110 resetXrunCounter(); 110 111 … … 125 126 126 127 bool StreamProcessor::prepareForEnable() { 127 int64_t diff=(int64_t)m_buffer_head_timestamp - (int64_t)m_buffer_tail_timestamp;128 129 128 debugOutput(DEBUG_LEVEL_VERBOSE," StreamProcessor::prepareForEnable for (%p)\n",this); 130 debugOutput(DEBUG_LEVEL_VERBOSE," Frame Counter : %05d\n",m_framecounter);131 debugOutput(DEBUG_LEVEL_VERBOSE," Buffer head timestamp : %011llu\n",m_buffer_head_timestamp);132 debugOutput(DEBUG_LEVEL_VERBOSE," Buffer tail timestamp : %011llu\n",m_buffer_tail_timestamp);133 debugOutput(DEBUG_LEVEL_VERBOSE," Head - Tail : %011lld\n",diff);134 129 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks()); 130 m_data_buffer->dumpInfo(); 135 131 return true; 136 132 } 137 133 138 134 bool StreamProcessor::prepareForDisable() { 139 int64_t diff=(int64_t)m_buffer_head_timestamp - (int64_t)m_buffer_tail_timestamp;140 141 135 debugOutput(DEBUG_LEVEL_VERBOSE," StreamProcessor::prepareForDisable for (%p)\n",this); 142 debugOutput(DEBUG_LEVEL_VERBOSE," Frame Counter : %05d\n",m_framecounter);143 debugOutput(DEBUG_LEVEL_VERBOSE," Buffer head timestamp : %011llu\n",m_buffer_head_timestamp);144 debugOutput(DEBUG_LEVEL_VERBOSE," Buffer tail timestamp : %011llu\n",m_buffer_tail_timestamp);145 debugOutput(DEBUG_LEVEL_VERBOSE," Head - Tail : %011lld\n",diff);146 136 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks()); 147 return true;148 137 m_data_buffer->dumpInfo(); 138 return true; 149 139 } 150 140 … … 152 142 153 143 debugOutput( DEBUG_LEVEL_VERBOSE, "Preparing...\n"); 154 // TODO: implement 155 144 156 145 // init the ports 157 146 … … 191 180 192 181 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Putting %d frames for %llu into frame buffer...\n", nbframes,ts); 193 incrementFrameCounter(nbframes, ts);182 m_data_buffer->incrementFrameCounter(nbframes, ts); 194 183 return true; 195 184 } … … 202 191 * 203 192 * @param nbframes the number of frames that are read from the internal buffers 204 * @param ts the new timestamp of the 'head' of the buffer, i.e. the first sample205 * present in the buffer.206 193 * @return true if successful 207 194 */ 208 bool StreamProcessor::getFrames(unsigned int nbframes , int64_t ts) {209 210 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Getting %d frames from frame buffer at (%011lld)...\n", nbframes, ts);211 decrementFrameCounter(nbframes, ts);195 bool StreamProcessor::getFrames(unsigned int nbframes) { 196 197 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Getting %d frames from frame buffer...\n", nbframes); 198 m_data_buffer->decrementFrameCounter(nbframes); 212 199 return true; 213 200 } … … 266 253 267 254 /** 268 * Decrements the frame counter, in a atomic way. This269 * also sets the buffer head timestamp270 * is thread safe.271 */272 void StreamProcessor::decrementFrameCounter(int nbframes, uint64_t new_timestamp) {273 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer head timestamp for (%p) to %11llu\n",274 this, new_timestamp);275 276 pthread_mutex_lock(&m_framecounter_lock);277 m_framecounter -= nbframes;278 m_buffer_head_timestamp = new_timestamp;279 pthread_mutex_unlock(&m_framecounter_lock);280 }281 282 /**283 * Increments the frame counter, in a atomic way.284 * also sets the buffer tail timestamp285 * This is thread safe.286 */287 void StreamProcessor::incrementFrameCounter(int nbframes, uint64_t new_timestamp) {288 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer tail timestamp for (%p) to %11llu\n",289 this, new_timestamp);290 291 pthread_mutex_lock(&m_framecounter_lock);292 m_framecounter += nbframes;293 m_buffer_tail_timestamp = new_timestamp;294 pthread_mutex_unlock(&m_framecounter_lock);295 296 }297 298 /**299 * Sets the buffer tail timestamp (in usecs)300 * This is thread safe.301 */302 void StreamProcessor::setBufferTailTimestamp(uint64_t new_timestamp) {303 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer tail timestamp for (%p) to %11llu\n",304 this, new_timestamp);305 306 pthread_mutex_lock(&m_framecounter_lock);307 m_buffer_tail_timestamp = new_timestamp;308 pthread_mutex_unlock(&m_framecounter_lock);309 }310 311 /**312 * Sets the buffer head timestamp (in usecs)313 * This is thread safe.314 */315 void StreamProcessor::setBufferHeadTimestamp(uint64_t new_timestamp) {316 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer head timestamp for (%p) to %11llu\n",317 this, new_timestamp);318 319 pthread_mutex_lock(&m_framecounter_lock);320 m_buffer_head_timestamp = new_timestamp;321 pthread_mutex_unlock(&m_framecounter_lock);322 }323 324 /**325 * Sets both the buffer head and tail timestamps (in usecs)326 * (avoids multiple mutex lock/unlock's)327 * This is thread safe.328 */329 void StreamProcessor::setBufferTimestamps(uint64_t new_head, uint64_t new_tail) {330 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Setting buffer head timestamp for (%p) to %11llu\n",331 this, new_head);332 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, " and buffer tail timestamp for (%p) to %11llu\n",333 this, new_tail);334 335 pthread_mutex_lock(&m_framecounter_lock);336 m_buffer_head_timestamp = new_head;337 m_buffer_tail_timestamp = new_tail;338 pthread_mutex_unlock(&m_framecounter_lock);339 }340 /**341 * \brief return the timestamp of the first frame in the buffer342 *343 * This function returns the timestamp of the very first sample in344 * the StreamProcessor's buffer. This is useful for slave StreamProcessors345 * to find out what the base for their timestamp generation should346 * be. It also returns the framecounter value for which this timestamp347 * is valid.348 *349 * The system is built in such a way that we assume that the processing350 * of the buffers doesn't take any time. Assume we have a buffer transfer at351 * time T1, meaning that the last sample of this buffer occurs at T1. As352 * processing does not take time, we don't have to add anything to T1. When353 * transferring the processed buffer to the xmit processor, the timestamp354 * of the last sample is still T1.355 *356 * When starting the streams, we don't have any information on this last357 * timestamp. We prefill the buffer at the xmit side, and we should find358 * out what the timestamp for the last sample in the buffer is. If we sync359 * on a receive SP, we know that the last prefilled sample corresponds with360 * the first sample received - 1 sample duration. This is the same as if the last361 * transfer from iso to client would have emptied the receive buffer.362 *363 *364 * @param ts address to store the timestamp in365 * @param fc address to store the associated framecounter in366 */367 void StreamProcessor::getBufferHeadTimestamp(uint64_t *ts, uint64_t *fc) {368 pthread_mutex_lock(&m_framecounter_lock);369 *fc = m_framecounter;370 *ts = m_buffer_head_timestamp;371 pthread_mutex_unlock(&m_framecounter_lock);372 }373 374 /**375 * \brief return the timestamp of the last frame in the buffer376 *377 * This function returns the timestamp of the last frame in378 * the StreamProcessor's buffer. It also returns the framecounter379 * value for which this timestamp is valid.380 *381 * @param ts address to store the timestamp in382 * @param fc address to store the associated framecounter in383 */384 void StreamProcessor::getBufferTailTimestamp(uint64_t *ts, uint64_t *fc) {385 pthread_mutex_lock(&m_framecounter_lock);386 *fc = m_framecounter;387 *ts = m_buffer_tail_timestamp;388 pthread_mutex_unlock(&m_framecounter_lock);389 }390 391 /**392 * Resets the frame counter, in a atomic way. This393 * is thread safe.394 */395 void StreamProcessor::resetFrameCounter() {396 pthread_mutex_lock(&m_framecounter_lock);397 m_framecounter = 0;398 pthread_mutex_unlock(&m_framecounter_lock);399 }400 401 /**402 255 * Resets the xrun counter, in a atomic way. This 403 256 * is thread safe. branches/streaming-rework/src/libstreaming/StreamProcessor.h
r390 r391 37 37 38 38 #include "libutil/StreamStatistics.h" 39 40 #include "libutil/TimestampedBuffer.h" 39 41 40 42 namespace FreebobStreaming { … … 51 53 */ 52 54 class StreamProcessor : public IsoStream, 53 public PortManager { 55 public PortManager, 56 public FreebobUtil::TimestampedBufferClient { 54 57 55 58 friend class StreamProcessorManager; … … 86 89 87 90 virtual bool putFrames(unsigned int nbframes, int64_t ts); ///< transfer the buffer contents from client 88 virtual bool getFrames(unsigned int nbframes , int64_t ts); ///< transfer the buffer contents to the client91 virtual bool getFrames(unsigned int nbframes); ///< transfer the buffer contents to the client 89 92 90 93 virtual bool reset(); ///< reset the streams & buffers (e.g. after xrun) … … 104 107 virtual bool prepareForDisable(); 105 108 109 public: 110 FreebobUtil::TimestampedBuffer *m_data_buffer; 111 106 112 protected: 107 108 113 109 114 void setManager(StreamProcessorManager *manager) {m_manager=manager;}; … … 145 150 */ 146 151 virtual bool canClientTransferFrames(unsigned int nframes) {return true;}; 147 148 int getFrameCounter() {return m_framecounter;};149 150 void decrementFrameCounter(int nbframes, uint64_t new_timestamp);151 void incrementFrameCounter(int nbframes, uint64_t new_timestamp);152 void resetFrameCounter();153 152 154 153 /** … … 188 187 uint64_t getTimeNow(); 189 188 190 void getBufferHeadTimestamp(uint64_t *ts, uint64_t *fc);191 void getBufferTailTimestamp(uint64_t *ts, uint64_t *fc);192 193 void setBufferTailTimestamp(uint64_t new_timestamp);194 void setBufferHeadTimestamp(uint64_t new_timestamp);195 void setBufferTimestamps(uint64_t new_head, uint64_t new_tail);196 197 189 bool setSyncSource(StreamProcessor *s); 198 190 float getTicksPerFrame() {return m_ticks_per_frame;}; 199 191 200 unsigned int getLastCycle() {return m_last_cycle;}; 201 202 private: 203 // the framecounter gives the number of frames in the buffer 204 signed int m_framecounter; 205 206 // the buffer tail timestamp gives the timestamp of the last frame 207 // that was put into the buffer 208 uint64_t m_buffer_tail_timestamp; 209 210 // the buffer head timestamp gives the timestamp of the first frame 211 // that was put into the buffer 212 uint64_t m_buffer_head_timestamp; 192 int getLastCycle() {return m_last_cycle;}; 193 213 194 214 195 protected: … … 217 198 float m_ticks_per_frame; 218 199 219 unsigned int m_last_cycle; 220 221 private: 222 // this mutex protects the access to the framecounter 223 // and the buffer head timestamp. 224 pthread_mutex_t m_framecounter_lock; 200 int m_last_cycle; 225 201 226 202 }; … … 252 228 253 229 protected: 254 255 DECLARE_DEBUG_MODULE; 230 bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset) {return true;}; 231 232 DECLARE_DEBUG_MODULE; 256 233 257 234 }; … … 282 259 283 260 protected: 284 285 DECLARE_DEBUG_MODULE; 261 bool processReadBlock(char *data, unsigned int nevents, unsigned int offset) {return true;}; 262 263 DECLARE_DEBUG_MODULE; 286 264 287 265 branches/streaming-rework/src/libstreaming/StreamProcessorManager.cpp
r390 r391 392 392 393 393 // FIXME: this should not be in cycles, but in 'time' 394 unsigned int enable_at=TICKS_TO_CYCLES(now)+300; 395 394 unsigned int enable_at=TICKS_TO_CYCLES(now)+2000; 395 if (enable_at > 8000) enable_at -= 8000; 396 396 397 debugOutput( DEBUG_LEVEL_VERBOSE, " Sync Source StreamProcessor...\n"); 397 398 if (!m_SyncSource->prepareForEnable()) { … … 835 836 if ((*it)->xrunOccurred()) { 836 837 debugWarning("Xrun on RECV SP %p due to ISO xrun\n",*it); 838 (*it)->dumpInfo(); 837 839 } 838 840 if (!((*it)->canClientTransferFrames(m_period))) { 839 841 debugWarning("Xrun on RECV SP %p due to buffer xrun\n",*it); 842 (*it)->dumpInfo(); 840 843 } 841 844 #endif … … 927 930 #endif 928 931 929 if(!(*it)->getFrames(m_period , (int64_t)m_time_of_transfer)) {932 if(!(*it)->getFrames(m_period)) { 930 933 debugOutput(DEBUG_LEVEL_VERBOSE,"could not getFrames(%u, %11llu) from stream processor (%p)", 931 934 m_period, m_time_of_transfer,*it); branches/streaming-rework/src/Makefile.am
r386 r391 46 46 libutil/ringbuffer.h libutil/PacketBuffer.h libutil/StreamStatistics.h \ 47 47 libutil/serialize.h libutil/SystemTimeSource.h libutil/Thread.h libutil/Time.h \ 48 libutil/TimeSource.h 48 libutil/TimeSource.h libutil/TimestampedBuffer.h 49 49 50 50 libfreebob_la_SOURCES = \ … … 105 105 libutil/SystemTimeSource.cpp \ 106 106 libutil/Time.c \ 107 libutil/TimeSource.cpp 107 libutil/TimeSource.cpp \ 108 libutil/TimestampedBuffer.cpp 108 109 109 110 libfreebob_la_LDFLAGS = \