Skip to content

Commit 0350409

Browse files
authored
Merge pull request #52 from podaen/main
Begin with stream true or false
2 parents 091682a + f6fb559 commit 0350409

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/AudioTools/AudioPlayer.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -596,19 +596,22 @@ namespace audio_tools {
596596
p_source->begin();
597597
meta_out.begin();
598598

599-
p_input_stream = p_source->selectStream(index);
600-
if (p_input_stream != nullptr) {
601-
if (meta_active) {
602-
copier.setCallbackOnWrite(decodeMetaData, this);
599+
if (index > 0) {
600+
p_input_stream = p_source->selectStream(index);
601+
if (p_input_stream != nullptr) {
602+
if (meta_active) {
603+
copier.setCallbackOnWrite(decodeMetaData, this);
604+
}
605+
copier.begin(*p_out_decoding, *p_input_stream);
606+
timeout = millis() + p_source->timeoutAutoNext();
607+
active = isActive;
608+
result = true;
609+
}
610+
else {
611+
LOGW("-> begin: no data found");
612+
active = isActive;
613+
result = false;
603614
}
604-
copier.begin(*p_out_decoding, *p_input_stream);
605-
timeout = millis() + p_source->timeoutAutoNext();
606-
active = isActive;
607-
result = true;
608-
}
609-
else {
610-
LOGW("-> begin: no data found");
611-
active = isActive;
612615
}
613616
return result;
614617
}

0 commit comments

Comments
 (0)