Commit 6a36015c authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

video_input: fallback to default if no video

When streaming a file with no video (music, for example), fall back to
the default device instead of cutting video altogether.

Change-Id: I0b30abff5339a38c6e5ed6c3b65d2cf49fa9104a
parent db6c3ddf
......@@ -488,6 +488,16 @@ VideoInput::initFile(std::string path)
return false;
}
// check if file has video, fall back to default device if none
// FIXME the way this is done is hackish, but it can't be done in createDecoder because that
// would break the promise returned in switchInput
DeviceParams p;
p.input = path;
auto dec = std::make_unique<MediaDecoder>();
if (dec->openInput(p) < 0 || dec->setupFromVideoData() < 0) {
return initCamera(ring::getVideoDeviceMonitor().getDefaultDevice());
}
clearOptions();
emulateRate_ = true;
decOpts_.input = path;
......
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