From 23465ad9855f4878fd7210bf076fed938a409b7d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Nov 2014 10:56:36 +0100 Subject: decoder/opus: improved error logging --- NEWS | 1 + src/decoder/plugins/OpusDecoderPlugin.cxx | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 9f7cd74fa..8a6f33c1b 100644 --- a/NEWS +++ b/NEWS @@ -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; } -- cgit v1.2.3