aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/VorbisDecoderPlugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/plugins/VorbisDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/VorbisDecoderPlugin.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/decoder/plugins/VorbisDecoderPlugin.cxx b/src/decoder/plugins/VorbisDecoderPlugin.cxx
index 8348407d6..e0d3d1374 100644
--- a/src/decoder/plugins/VorbisDecoderPlugin.cxx
+++ b/src/decoder/plugins/VorbisDecoderPlugin.cxx
@@ -347,8 +347,10 @@ vorbis_scan_stream(InputStream &is,
if (!vorbis_is_open(&vis, &vf))
return false;
- tag_handler_invoke_duration(handler, handler_ctx,
- (int)(ov_time_total(&vf, -1) + 0.5));
+ const auto total = ov_time_total(&vf, -1);
+ if (total >= 0)
+ tag_handler_invoke_duration(handler, handler_ctx,
+ SongTime::FromS(total));
vorbis_comments_scan(ov_comment(&vf, -1)->user_comments,
handler, handler_ctx);