diff options
author | Max Kellermann <max@duempel.org> | 2011-01-07 19:37:39 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-01-07 19:37:39 +0100 |
commit | 0022fb100b7d22b9612474ebee944e66c2a7b33b (patch) | |
tree | 56873bbb1968d21e62cae5d763bc693b3d20ba3c /src/encoder/lame_encoder.c | |
parent | 4f2d67dfb036e38be3bdb67d95eeb64bb7747d4f (diff) | |
download | mpd-0022fb100b7d22b9612474ebee944e66c2a7b33b.tar.gz mpd-0022fb100b7d22b9612474ebee944e66c2a7b33b.tar.xz mpd-0022fb100b7d22b9612474ebee944e66c2a7b33b.zip |
encoder/lame: explicitly configure the output sample rate
When you don't explicitly set an output sample rate, liblame tries to
guess an output sample rate from the input sample rate. You would
think that this "guessing" consists of just setting both equal, but
that is not the case. For 44.1kHz at 96kbit/s, liblame chooses
32kHz. This patch explicitly configures the output sample rate, to
stop the bad guessing.
Diffstat (limited to '')
-rw-r--r-- | src/encoder/lame_encoder.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/encoder/lame_encoder.c b/src/encoder/lame_encoder.c index acaf4470f..6c8f20890 100644 --- a/src/encoder/lame_encoder.c +++ b/src/encoder/lame_encoder.c @@ -169,6 +169,13 @@ lame_encoder_setup(struct lame_encoder *encoder, GError **error) return false; } + if (0 != lame_set_out_samplerate(encoder->gfp, + encoder->audio_format.sample_rate)) { + g_set_error(error, lame_encoder_quark(), 0, + "error setting lame out sample rate"); + return false; + } + if (0 > lame_init_params(encoder->gfp)) { g_set_error(error, lame_encoder_quark(), 0, "error initializing lame params"); |