Commit 2dbf8a4
committed
opus: do not add 5 dB to Opus header playback gain
The playback gain in the Opus header is not related to any reference
like ReplayGain or EBU R128. It thus does not need converting into the
ReplayGain "space".
This patch thus removes the 5 dB offset from the fallback path in
MPDOpusDecoder::HandleAudio (where the Opus header gain is converted
into ReplayGain metadata).
Otherwise, an Opus file without replay gain tags and with an output
gain of 0 dB would get a gain of 5 dB. This leads to clipping if the
audio data has less than 5 dB of headroom.
The clipping can be reproduced with something as simple as an amplitude
1.0 sine file. One way to create such a file is via audacity:
1. Generate -> Tone...
- Waveform = Sine
- Frequency = 440 Hz
- Amplitude = 1
- Duration = 1m
2. File -> Export Audio
- Channels = mono
- Sample rate = 48000 Hz
- Encoding = signed 16-bit PCM
3. Run opusenc on the resulting file1 parent 98c06a9 commit 2dbf8a4
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| |||
0 commit comments