decoder/mad: make "current_frame" zero-based
Increment "current_frame" after processing the frame.
This commit is contained in:
parent
c87d6825ec
commit
4f56fdc397
@ -863,7 +863,7 @@ MadDecoder::SyncAndSend() noexcept
|
|||||||
drop_start_frames--;
|
drop_start_frames--;
|
||||||
return DecoderCommand::NONE;
|
return DecoderCommand::NONE;
|
||||||
} else if ((drop_end_frames > 0) &&
|
} else if ((drop_end_frames > 0) &&
|
||||||
(current_frame == (max_frames + 1 - drop_end_frames))) {
|
current_frame == max_frames - drop_end_frames) {
|
||||||
/* stop decoding, effectively dropping all remaining
|
/* stop decoding, effectively dropping all remaining
|
||||||
frames */
|
frames */
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
@ -877,7 +877,7 @@ MadDecoder::SyncAndSend() noexcept
|
|||||||
|
|
||||||
unsigned pcm_length = synth.pcm.length;
|
unsigned pcm_length = synth.pcm.length;
|
||||||
if (drop_end_samples &&
|
if (drop_end_samples &&
|
||||||
(current_frame == max_frames - drop_end_frames)) {
|
current_frame == max_frames - drop_end_frames - 1) {
|
||||||
if (drop_end_samples >= pcm_length)
|
if (drop_end_samples >= pcm_length)
|
||||||
pcm_length = 0;
|
pcm_length = 0;
|
||||||
else
|
else
|
||||||
@ -889,7 +889,7 @@ MadDecoder::SyncAndSend() noexcept
|
|||||||
return cmd;
|
return cmd;
|
||||||
|
|
||||||
if (drop_end_samples &&
|
if (drop_end_samples &&
|
||||||
(current_frame == max_frames - drop_end_frames))
|
current_frame == max_frames - drop_end_frames - 1)
|
||||||
/* stop decoding, effectively dropping
|
/* stop decoding, effectively dropping
|
||||||
* all remaining samples */
|
* all remaining samples */
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
@ -900,20 +900,21 @@ MadDecoder::SyncAndSend() noexcept
|
|||||||
inline bool
|
inline bool
|
||||||
MadDecoder::Read() noexcept
|
MadDecoder::Read() noexcept
|
||||||
{
|
{
|
||||||
UpdateTimerNextFrame();
|
|
||||||
|
|
||||||
switch (mute_frame) {
|
switch (mute_frame) {
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
|
|
||||||
case MadDecoderMuteFrame::SKIP:
|
case MadDecoderMuteFrame::SKIP:
|
||||||
mute_frame = MadDecoderMuteFrame::NONE;
|
mute_frame = MadDecoderMuteFrame::NONE;
|
||||||
|
UpdateTimerNextFrame();
|
||||||
break;
|
break;
|
||||||
case MadDecoderMuteFrame::SEEK:
|
case MadDecoderMuteFrame::SEEK:
|
||||||
if (elapsed_time >= seek_time)
|
if (elapsed_time >= seek_time)
|
||||||
mute_frame = MadDecoderMuteFrame::NONE;
|
mute_frame = MadDecoderMuteFrame::NONE;
|
||||||
|
UpdateTimerNextFrame();
|
||||||
break;
|
break;
|
||||||
case MadDecoderMuteFrame::NONE:
|
case MadDecoderMuteFrame::NONE:
|
||||||
cmd = SyncAndSend();
|
cmd = SyncAndSend();
|
||||||
|
UpdateTimerNextFrame();
|
||||||
if (cmd == DecoderCommand::SEEK) {
|
if (cmd == DecoderCommand::SEEK) {
|
||||||
assert(input_stream.IsSeekable());
|
assert(input_stream.IsSeekable());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user