diff options
author | Max Kellermann <max@duempel.org> | 2014-11-11 10:56:36 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-11 11:20:03 +0100 |
commit | 23465ad9855f4878fd7210bf076fed938a409b7d (patch) | |
tree | 907ead829d53771038dcb1d17b9d59bc8e15ecb5 | |
parent | 7886a14b74f58896670bb8c0573646cd1a947d05 (diff) |
decoder/opus: improved error logging
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/decoder/plugins/OpusDecoderPlugin.cxx | 15 |
2 files changed, 12 insertions, 4 deletions
@@ -10,6 +10,7 @@ ver 0.19.3 (not yet released) - audiofile: fix bit rate calculation - ffmpeg: support opus - opus: fix bogus duration on streams + - opus: improved error logging * fix distorted audio with soxr resampler * fix build failure on Mac OS X with non-Apple compilers diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx index a4be8eb60..c3ac96687 100644 --- a/src/decoder/plugins/OpusDecoderPlugin.cxx +++ b/src/decoder/plugins/OpusDecoderPlugin.cxx @@ -167,8 +167,10 @@ MPDOpusDecoder::HandlePacket(const ogg_packet &packet) if (packet.b_o_s) return HandleBOS(packet); - else if (opus_decoder == nullptr) + else if (opus_decoder == nullptr) { + LogDebug(opus_domain, "BOS packet expected"); return DecoderCommand::STOP; + } if (IsOpusTags(packet)) return HandleTags(packet); @@ -229,13 +231,17 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet) { assert(packet.b_o_s); - if (opus_decoder != nullptr || !IsOpusHead(packet)) + if (opus_decoder != nullptr || !IsOpusHead(packet)) { + LogDebug(opus_domain, "BOS packet must be OpusHead"); return DecoderCommand::STOP; + } unsigned channels; if (!ScanOpusHeader(packet.packet, packet.bytes, channels) || - !audio_valid_channel_count(channels)) + !audio_valid_channel_count(channels)) { + LogDebug(opus_domain, "Malformed BOS packet"); return DecoderCommand::STOP; + } assert(opus_decoder == nullptr); assert(output_buffer == nullptr); @@ -307,7 +313,8 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet) output_buffer, opus_output_buffer_frames, 0); if (nframes < 0) { - LogError(opus_domain, opus_strerror(nframes)); + FormatError(opus_domain, "libopus error: %s", + opus_strerror(nframes)); return DecoderCommand::STOP; } |