aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/OpusDecoderPlugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/plugins/OpusDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/OpusDecoderPlugin.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx
index 2de827c7f..97c81984c 100644
--- a/src/decoder/plugins/OpusDecoderPlugin.cxx
+++ b/src/decoder/plugins/OpusDecoderPlugin.cxx
@@ -441,9 +441,12 @@ mpd_opus_scan_stream(InputStream &is,
}
}
- if (packet.e_o_s || OggSeekFindEOS(oy, os, packet, is))
- tag_handler_invoke_duration(handler, handler_ctx,
- packet.granulepos / opus_sample_rate);
+ if (packet.e_o_s || OggSeekFindEOS(oy, os, packet, is)) {
+ const auto duration =
+ SongTime::FromScale<uint64_t>(packet.granulepos,
+ opus_sample_rate);
+ tag_handler_invoke_duration(handler, handler_ctx, duration);
+ }
ogg_stream_clear(&os);