mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
win-dshow: Fix bad settings causing frozen video
If the settings are reset to defaults or if the settings are just bad, the video would get stuck on the last frame that was displayed, which feels a bit awkward. Best to make it stop video output entirely rather than get stuck on the last video frame.
This commit is contained in:
@@ -232,7 +232,7 @@ struct DShowInput {
|
||||
void SetActive(bool active);
|
||||
inline enum video_colorspace GetColorSpace(obs_data_t *settings) const;
|
||||
inline enum video_range_type GetColorRange(obs_data_t *settings) const;
|
||||
inline void Activate(obs_data_t *settings);
|
||||
inline bool Activate(obs_data_t *settings);
|
||||
inline void Deactivate();
|
||||
|
||||
inline void SetupBuffering(obs_data_t *settings);
|
||||
@@ -288,7 +288,10 @@ void DShowInput::DShowLoop()
|
||||
{
|
||||
obs_data_t *settings;
|
||||
settings = obs_source_get_settings(source);
|
||||
Activate(settings);
|
||||
if (!Activate(settings)) {
|
||||
obs_source_output_video(source,
|
||||
nullptr);
|
||||
}
|
||||
obs_data_release(settings);
|
||||
break;
|
||||
}
|
||||
@@ -863,15 +866,15 @@ inline enum video_range_type DShowInput::GetColorRange(
|
||||
VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL;
|
||||
}
|
||||
|
||||
inline void DShowInput::Activate(obs_data_t *settings)
|
||||
inline bool DShowInput::Activate(obs_data_t *settings)
|
||||
{
|
||||
if (!device.ResetGraph())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!UpdateVideoConfig(settings)) {
|
||||
blog(LOG_WARNING, "%s: Video configuration failed",
|
||||
obs_source_get_name(source));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!UpdateAudioConfig(settings))
|
||||
@@ -879,10 +882,10 @@ inline void DShowInput::Activate(obs_data_t *settings)
|
||||
"audio", obs_source_get_name(source));
|
||||
|
||||
if (!device.ConnectFilters())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (device.Start() != Result::Success)
|
||||
return;
|
||||
return false;
|
||||
|
||||
enum video_colorspace cs = GetColorSpace(settings);
|
||||
|
||||
@@ -895,6 +898,8 @@ inline void DShowInput::Activate(obs_data_t *settings)
|
||||
blog(LOG_ERROR, "Failed to get video format parameters for " \
|
||||
"video format %u", cs);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void DShowInput::Deactivate()
|
||||
|
||||
Reference in New Issue
Block a user