- Timestamp:
- 07/13/08 15:23:09 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/src/libstreaming/generic/StreamProcessor.cpp
r1292 r1293 390 390 391 391 if (result == eCRV_OK) { 392 #ifdef DEBUG392 // #ifdef DEBUG 393 393 int ticks_per_packet = (int)(getTicksPerFrame() * getNominalFramesPerPacket()); 394 394 int diff = diffTicks(m_last_timestamp, m_last_timestamp2); … … 401 401 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 402 402 m_last_timestamp, diff, ticks_per_packet); 403 // !!!HACK!!! FIXME: this is the result of a failure in wrapping/unwrapping somewhere 404 // it's definitely a bug. 405 // try to fix up the timestamp 406 int64_t last_timestamp_fixed; 407 // first try to add one second 408 last_timestamp_fixed = m_last_timestamp + TICKS_PER_SECOND; 409 diff = diffTicks(last_timestamp_fixed, m_last_timestamp2); 410 if(diff-ticks_per_packet < 50 && diff-ticks_per_packet > -50) { 411 debugWarning("cy %04u rather large TSP difference TS=%011llu => TS=%011llu (%d, nom %d)\n", 412 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 413 m_last_timestamp, diff, ticks_per_packet); 414 debugWarning("HACK: fixed by adding one second of ticks. This is a bug being run-time fixed.\n"); 415 m_last_timestamp = last_timestamp_fixed; 416 } 417 // then try to subtract one second 418 last_timestamp_fixed = m_last_timestamp - TICKS_PER_SECOND; 419 if(last_timestamp_fixed >= 0) { 420 diff = diffTicks(last_timestamp_fixed, m_last_timestamp2); 421 if(diff-ticks_per_packet < 50 && diff-ticks_per_packet > -50) { 422 debugWarning("cy %04u rather large TSP difference TS=%011llu => TS=%011llu (%d, nom %d)\n", 423 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 424 m_last_timestamp, diff, ticks_per_packet); 425 debugWarning("HACK: fixed by subtracing one second of ticks. This is a bug being run-time fixed.\n"); 426 m_last_timestamp = last_timestamp_fixed; 427 } 428 } 403 429 } 404 430 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, … … 407 433 m_last_timestamp2, m_last_timestamp, 408 434 diff, ticks_per_packet); 409 #endif435 // #endif 410 436 411 437 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, … … 906 932 StreamProcessor::shiftStream(int nbframes) 907 933 { 934 // FIXME: this is not a good idea since the ISO thread is also writing the buffer 935 // resulting in multiple writers (not supported) 908 936 bool result; 909 937 if(nbframes == 0) return true; 910 938 if(nbframes > 0) { 939 debugOutput(DEBUG_LEVEL_VERBOSE, 940 "(%p) dropping %d frames\n", 941 this, nbframes); 911 942 result = m_data_buffer->dropFrames(nbframes); 912 SIGNAL_ACTIVITY_ALL; 943 } else { 944 result = false; 913 945 return result; 914 } else { 915 result = true; 946 debugOutput(DEBUG_LEVEL_VERBOSE, 947 "(%p) adding %d frames\n", 948 this, nbframes); 916 949 while(nbframes++) { 917 950 result &= m_data_buffer->writeDummyFrame(); 918 951 } 919 SIGNAL_ACTIVITY_ALL;920 return result;921 }952 } 953 SIGNAL_ACTIVITY_ALL; 954 return result; 922 955 } 923 956