From a0a74951b87402aefd15c5d93d51e5912372962f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Aug 2019 00:38:45 +0200 Subject: [PATCH] decoder/mad: eliminate attribute "bit_rate" This also fixes a bug which caused the bit rate to not update after seeking. --- NEWS | 1 + src/decoder/plugins/MadDecoderPlugin.cxx | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index d6bed1990..ed5b4d94c 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ver 0.21.12 (not yet released) * decoder + - mad: update bit rate after seeking - opus: ignore case in replay gain tag names - opus, vorbis: decode the "end of stream" packet * output diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx index 18ae27530..509fb1381 100644 --- a/src/decoder/plugins/MadDecoderPlugin.cxx +++ b/src/decoder/plugins/MadDecoderPlugin.cxx @@ -132,7 +132,6 @@ struct MadDecoder { bool found_replay_gain = false; bool found_first_frame = false; bool decoded_first_frame = false; - unsigned long bit_rate; DecoderClient *const client; InputStream &input_stream; enum mad_layer layer = mad_layer(0); @@ -788,7 +787,6 @@ MadDecoder::UpdateTimerNextFrame() noexcept if (current_frame >= highest_frame) { /* record this frame's properties in frame_offsets (for seeking) and times */ - bit_rate = frame.header.bitrate; if (current_frame >= max_frames) /* cap current_frame */ @@ -829,7 +827,7 @@ MadDecoder::SendPCM(unsigned i, unsigned pcm_length) noexcept auto cmd = client->SubmitData(input_stream, output_buffer, sizeof(output_buffer[0]) * num_samples, - bit_rate / 1000); + frame.header.bitrate / 1000); if (cmd != DecoderCommand::NONE) return cmd; }