Improved handling of problematic video requiring software decode.

Always allow disabling hardware en/decode.
Warn and try to get info when gst discoverer errors.
This commit is contained in:
Ryan Kelln
2023-05-19 15:08:47 -04:00
parent e8b05cd7c2
commit 26cb75f93f
2 changed files with 18 additions and 15 deletions

View File

@@ -139,7 +139,8 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri)
video_stream_info.log = "Invalid URI"; video_stream_info.log = "Invalid URI";
break; break;
case GST_DISCOVERER_ERROR: case GST_DISCOVERER_ERROR:
video_stream_info.log = std::string( "Error; " ) + err->message; video_stream_info.log = std::string( "Warning: " ) + err->message;
result = GST_DISCOVERER_OK; // try to read the file anyways, discoverer can report errors but still read the file
break; break;
case GST_DISCOVERER_TIMEOUT: case GST_DISCOVERER_TIMEOUT:
video_stream_info.log = "Timeout loading"; video_stream_info.log = "Timeout loading";
@@ -355,7 +356,7 @@ void MediaPlayer::execute_open()
return; return;
} }
// setup uridecodebin // setup software decode
if (force_software_decoding_) { if (force_software_decoding_) {
g_object_set (G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder")), "force-sw-decoders", true, NULL); g_object_set (G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder")), "force-sw-decoders", true, NULL);
} }
@@ -584,8 +585,11 @@ bool MediaPlayer::isImage() const
std::string MediaPlayer::decoderName() std::string MediaPlayer::decoderName()
{ {
if (pipeline_) { if (pipeline_) {
if (force_software_decoding_) {
decoder_name_ = "software";
}
// decoder_name_ not initialized // decoder_name_ not initialized
if (decoder_name_.empty()) { else if (decoder_name_.empty()) {
// try to know if it is a hardware decoder // try to know if it is a hardware decoder
decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_); decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_);
// nope, then it is a sofware decoder // nope, then it is a sofware decoder

View File

@@ -3146,20 +3146,19 @@ void SourceController::Render()
mediaplayer_active_->setRewindOnDisabled(true); mediaplayer_active_->setRewindOnDisabled(true);
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (Settings::application.render.gpu_decoding) // always allow for hardware decoding to be disabled
ImGui::Separator();
if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding"))
{ {
ImGui::Separator(); bool hwdec = !mediaplayer_active_->softwareDecodingForced();
if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding")) if (ImGui::MenuItem("Auto", "", &hwdec ))
{ mediaplayer_active_->setSoftwareDecodingForced(false);
bool hwdec = !mediaplayer_active_->softwareDecodingForced(); hwdec = mediaplayer_active_->softwareDecodingForced();
if (ImGui::MenuItem("Auto", "", &hwdec )) if (ImGui::MenuItem("Disabled", "", &hwdec ))
mediaplayer_active_->setSoftwareDecodingForced(false); mediaplayer_active_->setSoftwareDecodingForced(true);
hwdec = mediaplayer_active_->softwareDecodingForced(); ImGui::EndMenu();
if (ImGui::MenuItem("Disabled", "", &hwdec ))
mediaplayer_active_->setSoftwareDecodingForced(true);
ImGui::EndMenu();
}
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }