Commit ec308394 authored by Max Kellermann's avatar Max Kellermann

mp3: assert that the stream is seekable

dc_seek() won't send a SEEK command to the decoder thread unless the stream is seekable. No need to do another check; convert that to an assertion.
parent 78b08f03
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "../log.h" #include "../log.h"
#include "../conf.h" #include "../conf.h"
#include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
...@@ -949,9 +950,11 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r) ...@@ -949,9 +950,11 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
* all remaining samples */ * all remaining samples */
return DECODE_BREAK; return DECODE_BREAK;
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK && if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
data->input_stream->seekable) {
unsigned long j = 0; unsigned long j = 0;
assert(data->input_stream->seekable);
data->mute_frame = MUTEFRAME_SEEK; data->mute_frame = MUTEFRAME_SEEK;
while (j < data->highest_frame && while (j < data->highest_frame &&
decoder_seek_where(decoder) > decoder_seek_where(decoder) >
...@@ -969,9 +972,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r) ...@@ -969,9 +972,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
decoder_seek_error(decoder); decoder_seek_error(decoder);
data->mute_frame = MUTEFRAME_NONE; data->mute_frame = MUTEFRAME_NONE;
} }
} else if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK &&
!data->input_stream->seekable) {
decoder_seek_error(decoder);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment