Commit a37ad5d
committed
audio: use monotonic counter-based PTS for AAC RTSP streams
Replace gettimeofday() with a wallclock-anchored monotonic counter for
AAC audio fPresentationTime in IMPDeviceSource. On the first AAC frame
we snapshot gettimeofday() as the base, then advance by exactly
frameCount * 1024 / sampleRate microseconds per frame.
This produces strictly monotonic +1024-sample RTP PTS increments
(verified via ffprobe) while staying in the gettimeofday() clock domain
required by live555 RTCP SR (RFC 3550 §6.4.1) for correct NTP-RTP
timestamp pairing and inter-stream synchronization.
The previous gettimeofday()-per-frame approach introduced OS scheduling
jitter causing non-monotonic DTS that broke FFmpeg/Frigate MP4 muxing.
Also fix AudioReframer timestamp increment from microseconds (*1000000)
to milliseconds (*1000) to match the actual unit used by callers.
Fixes: themactep/thingino-firmware#10821 parent 48104af commit a37ad5d
2 files changed
Lines changed: 28 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 4 | + | |
17 | 5 | | |
18 | 6 | | |
19 | 7 | | |
| |||
76 | 64 | | |
77 | 65 | | |
78 | 66 | | |
79 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
80 | 93 | | |
81 | 94 | | |
82 | 95 | | |
| |||
0 commit comments