decoder/opus: fix replay gain when there are no other tags

The `tag_builder.empty()` check was wrong for the SubmitReplayGain()
call.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/497
This commit is contained in:
Max Kellermann 2019-03-16 13:55:19 +01:00
parent a4b8a0d801
commit 1aa7cdd602
2 changed files with 7 additions and 3 deletions

2
NEWS
View File

@ -5,6 +5,8 @@ ver 0.21.6 (not yet released)
- fix "list" with filter expression - fix "list" with filter expression
* input * input
- cdio_paranoia: fix build failure due to missing #include - cdio_paranoia: fix build failure due to missing #include
* decoder
- opus: fix replay gain when there are no other tags
* playlist * playlist
- flac: fix use-after-free bug - flac: fix use-after-free bug
* support abstract sockets on Linux * support abstract sockets on Linux

View File

@ -208,10 +208,12 @@ MPDOpusDecoder::HandleTags(const ogg_packet &packet)
TagBuilder tag_builder; TagBuilder tag_builder;
AddTagHandler h(tag_builder); AddTagHandler h(tag_builder);
if (ScanOpusTags(packet.packet, packet.bytes, &rgi, h) && if (!ScanOpusTags(packet.packet, packet.bytes, &rgi, h))
!tag_builder.empty()) { return;
client.SubmitReplayGain(&rgi);
client.SubmitReplayGain(&rgi);
if (!tag_builder.empty()) {
Tag tag = tag_builder.Commit(); Tag tag = tag_builder.Commit();
auto cmd = client.SubmitTag(input_stream, std::move(tag)); auto cmd = client.SubmitTag(input_stream, std::move(tag));
if (cmd != DecoderCommand::NONE) if (cmd != DecoderCommand::NONE)