decoder/opus: simplify indentation in HandleAudio()
This commit is contained in:
parent
46eab05045
commit
4244e61214
@ -250,34 +250,36 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
|
|||||||
packet.bytes,
|
packet.bytes,
|
||||||
output_buffer, opus_output_buffer_frames,
|
output_buffer, opus_output_buffer_frames,
|
||||||
0);
|
0);
|
||||||
if (nframes < 0)
|
if (gcc_unlikely(nframes <= 0)) {
|
||||||
throw FormatRuntimeError("libopus error: %s",
|
if (nframes < 0)
|
||||||
opus_strerror(nframes));
|
throw FormatRuntimeError("libopus error: %s",
|
||||||
|
opus_strerror(nframes));
|
||||||
if (nframes > 0) {
|
else
|
||||||
/* apply the "skip" value */
|
|
||||||
if (skip >= (unsigned)nframes) {
|
|
||||||
skip -= nframes;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
const opus_int16 *data = output_buffer;
|
|
||||||
data += skip * previous_channels;
|
|
||||||
nframes -= skip;
|
|
||||||
skip = 0;
|
|
||||||
|
|
||||||
/* submit decoded samples to the DecoderClient */
|
|
||||||
const size_t nbytes = nframes * frame_size;
|
|
||||||
auto cmd = client.SubmitData(input_stream,
|
|
||||||
data, nbytes,
|
|
||||||
0);
|
|
||||||
if (cmd != DecoderCommand::NONE)
|
|
||||||
throw cmd;
|
|
||||||
|
|
||||||
if (packet.granulepos > 0)
|
|
||||||
client.SubmitTimestamp(FloatDuration(packet.granulepos - pre_skip)
|
|
||||||
/ opus_sample_rate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* apply the "skip" value */
|
||||||
|
if (skip >= (unsigned)nframes) {
|
||||||
|
skip -= nframes;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const opus_int16 *data = output_buffer;
|
||||||
|
data += skip * previous_channels;
|
||||||
|
nframes -= skip;
|
||||||
|
skip = 0;
|
||||||
|
|
||||||
|
/* submit decoded samples to the DecoderClient */
|
||||||
|
const size_t nbytes = nframes * frame_size;
|
||||||
|
auto cmd = client.SubmitData(input_stream,
|
||||||
|
data, nbytes,
|
||||||
|
0);
|
||||||
|
if (cmd != DecoderCommand::NONE)
|
||||||
|
throw cmd;
|
||||||
|
|
||||||
|
if (packet.granulepos > 0)
|
||||||
|
client.SubmitTimestamp(FloatDuration(packet.granulepos - pre_skip)
|
||||||
|
/ opus_sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user