1505 | | _UpdateTimeSource(bufferInfo, input->fOldBufferInfo, |
1506 | | *input); |
| 1521 | // _UpdateTimeSource(bufferInfo, input->fOldBufferInfo, |
| 1522 | // *input); |
| 1523 | |
| 1524 | //rud: OSS multi-audio node: |
| 1525 | |
| 1526 | |
| 1527 | // update the timesource |
| 1528 | //orig OSS: |
| 1529 | // if (input->fEngineIndex == 0 && input->fThread >= 0) { |
| 1530 | |
| 1531 | bigtime_t realTime = RealTime(); |
| 1532 | bigtime_t realPlaybackDuration = realTime - lastRealTime; |
| 1533 | // bigtime_t performanceTime |
| 1534 | // = time_for_buffer(bytesWritten, input->fInput.format); |
| 1535 | //this is orig hmulti: is same as above from OSS. |
| 1536 | bigtime_t performanceTime = (bigtime_t)(bufferInfo.played_frames_count / |
| 1537 | input->fInput.format.u.raw_audio.frame_rate * 1000000LL); |
| 1538 | |
| 1539 | |
| 1540 | float drift = (double)(performanceTime |
| 1541 | - lastPerformanceTime) / realPlaybackDuration; |
| 1542 | //drift = 1.0; |
| 1543 | lastPerformanceTime = performanceTime; |
| 1544 | lastRealTime = realTime; |
| 1545 | |
| 1546 | driftValues[currentDriftValueIndex++] = drift; |
| 1547 | if (currentDriftValueIndex == driftValueCount) |
| 1548 | currentDriftValueIndex = 0; |
| 1549 | |
| 1550 | drift = 0.0; |
| 1551 | for (int32 i = 0; i < driftValueCount; i++) |
| 1552 | drift += driftValues[i]; |
| 1553 | drift /= driftValueCount; |
| 1554 | |
| 1555 | //orig OSS: |
| 1556 | // if (fDevice->Locker()->Lock()) { |
| 1557 | // if (input->fThread >= 0) |
| 1558 | if (input->fChannelId == 0) |
| 1559 | PublishTime(performanceTime, realTime, drift); |
| 1560 | //orig OSS: |
| 1561 | // fDevice->Locker()->Unlock(); |
| 1562 | // } |
| 1563 | // } |
| 1564 | //end rudolf<<<<<< |
| 1565 | |
| 1566 | |
| 1567 | //orig hmulti: |
| 1568 | |
| 1569 | // bigtime_t performanceTime = (bigtime_t)(info.played_frames_count / |
| 1570 | // input.fInput.format.u.raw_audio.frame_rate * 1000000LL); |
| 1571 | // bigtime_t realTime = info.played_real_time; |
| 1572 | // float drift = ((info.played_frames_count - oldInfo.played_frames_count) |
| 1573 | // / input.fInput.format.u.raw_audio.frame_rate * 1000000LL) |
| 1574 | // / (info.played_real_time - oldInfo.played_real_time); |
| 1575 | |
| 1576 | // PublishTime(performanceTime, realTime, drift); |
| 1577 | |
| 1578 | //end orig hmulti. |