commit c3aee49802ac999e3a2be9320c7796241b5b9f52
Author: Mark Spieth <mspieth@digivation.com.au>
Date: Thu Mar 7 12:07:45 2013 +1100
fix bad avsync
diff --git a/mythtv/libs/libmyth/audio/audiooutputbase.cpp b/mythtv/libs/libmyth/audio/audiooutputbase.cpp
index 2653076..121178c 100644
|
a
|
b
|
int64_t AudioOutputBase::GetAudiotime(void) |
| 1086 | 1086 | .arg(soundcard_buffer) |
| 1087 | 1087 | .arg(main_buffer+soundcard_buffer) |
| 1088 | 1088 | .arg(samplerate).arg(obpf).arg(bytes_per_frame).arg(stretchfactor) |
| 1089 | | .arg((main_buffer + soundcard_buffer) * eff_stretchfactor) |
| 1090 | | .arg(((main_buffer + soundcard_buffer) * eff_stretchfactor ) / |
| | 1089 | .arg((int64_t)(main_buffer + soundcard_buffer) * eff_stretchfactor) |
| | 1090 | .arg(((int64_t)(main_buffer + soundcard_buffer) * eff_stretchfactor ) / |
| 1091 | 1091 | (effdsp * obpf)) |
| 1092 | 1092 | ); |
| 1093 | 1093 | |
| … |
… |
void AudioOutputBase::SetAudiotime(int frames, int64_t timecode) |
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | audbuf_timecode = |
| 1126 | | timecode + (effdsp ? ((frames + processframes_unstretched * 100000) + |
| | 1126 | timecode + (effdsp ? ((frames + processframes_unstretched) * 100000 + |
| 1127 | 1127 | (processframes_stretched * eff_stretchfactor) |
| 1128 | 1128 | ) / effdsp : 0); |
| 1129 | 1129 | |
| … |
… |
bool AudioOutputBase::AddFrames(void *in_buffer, int in_frames, |
| 1319 | 1319 | bool AudioOutputBase::AddData(void *in_buffer, int in_len, |
| 1320 | 1320 | int64_t timecode, int /*in_frames*/) |
| 1321 | 1321 | { |
| 1322 | | int frames = in_len / source_bytes_per_frame; |
| | 1322 | int in_frames= in_len / source_bytes_per_frame; |
| | 1323 | int frames = in_frames; |
| 1323 | 1324 | void *buffer = in_buffer; |
| 1324 | 1325 | int bpf = bytes_per_frame; |
| 1325 | 1326 | int len = in_len; |
| … |
… |
bool AudioOutputBase::AddData(void *in_buffer, int in_len, |
| 1432 | 1433 | } |
| 1433 | 1434 | |
| 1434 | 1435 | int frames_remaining = frames; |
| 1435 | | int frames_final = 0; |
| 1436 | 1436 | int maxframes = (kAudioSRCInputSize / source_channels) & ~0xf; |
| 1437 | 1437 | int offset = 0; |
| 1438 | 1438 | |
| … |
… |
bool AudioOutputBase::AddData(void *in_buffer, int in_len, |
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | frames = len / bpf; |
| 1493 | | frames_final += frames; |
| 1494 | 1493 | |
| 1495 | 1494 | bdiff = kAudioRingBufferSize - waud; |
| 1496 | 1495 | if ((len % bpf) != 0 && bdiff < len) |
| … |
… |
bool AudioOutputBase::AddData(void *in_buffer, int in_len, |
| 1589 | 1588 | waud = org_waud; |
| 1590 | 1589 | } |
| 1591 | 1590 | |
| 1592 | | SetAudiotime(frames_final, timecode); |
| | 1591 | SetAudiotime(in_frames, timecode); |
| 1593 | 1592 | |
| 1594 | 1593 | return true; |
| 1595 | 1594 | } |