Fail streaming on error in any stream.

This commit is contained in:
John Preston 2019-03-14 12:47:18 +04:00
parent 2152fe6a79
commit bfb6ecbac7

View File

@ -219,15 +219,10 @@ bool Player::fileReady(Stream &&video, Stream &&audio) {
streamReady(std::move(data)); streamReady(std::move(data));
}); });
}; };
const auto error = [&](auto &stream) { const auto error = [=](Error error) {
return [=, &stream](Error error) { crl::on_main(weak, [=] {
crl::on_main(weak, [=, &stream] { streamFailed(error);
if (_stage == Stage::Initializing) { });
stream = nullptr;
}
streamFailed(error);
});
};
}; };
const auto mode = _options.mode; const auto mode = _options.mode;
if ((mode != Mode::Audio && mode != Mode::Both) if ((mode != Mode::Audio && mode != Mode::Both)
@ -254,7 +249,7 @@ bool Player::fileReady(Stream &&video, Stream &&audio) {
std::move(audio), std::move(audio),
_audioId, _audioId,
ready, ready,
error(_audio)); error);
} else if (audio.index >= 0) { } else if (audio.index >= 0) {
LOG(("Streaming Error: No codec for audio stream %1, mode %2." LOG(("Streaming Error: No codec for audio stream %1, mode %2."
).arg(audio.index ).arg(audio.index
@ -269,7 +264,7 @@ bool Player::fileReady(Stream &&video, Stream &&audio) {
std::move(video), std::move(video),
_audioId, _audioId,
ready, ready,
error(_video)); error);
} else if (video.index >= 0) { } else if (video.index >= 0) {
LOG(("Streaming Error: No codec for video stream %1, mode %2." LOG(("Streaming Error: No codec for video stream %1, mode %2."
).arg(video.index ).arg(video.index
@ -391,11 +386,7 @@ void Player::streamReady(Information &&information) {
} }
void Player::streamFailed(Error error) { void Player::streamFailed(Error error) {
if (_stage == Stage::Initializing) { fail(error);
provideStartInformation();
} else {
fail(error);
}
} }
template <typename Track> template <typename Track>