decoder/mad: eliminate attribute "bit_rate"

This also fixes a bug which caused the bit rate to not update after
seeking.
This commit is contained in:
Max Kellermann 2019-08-03 00:38:45 +02:00
parent 779a6855ff
commit a0a74951b8
2 changed files with 2 additions and 3 deletions

1
NEWS
View File

@ -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

View File

@ -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;
}