mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-16 12:49:59 +01:00
BugFix: Clone source failed do not crash
Clone source that lost its origin can be replaced.
This commit is contained in:
@@ -212,8 +212,9 @@ guint64 CloneSource::playtime () const
|
||||
{
|
||||
if (filter_->type() != FrameBufferFilter::FILTER_PASSTHROUGH)
|
||||
return guint64( filter_->updateTime() * GST_SECOND ) ;
|
||||
|
||||
return origin_->playtime();
|
||||
if (origin_)
|
||||
return origin_->playtime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -221,8 +222,7 @@ uint CloneSource::texture() const
|
||||
{
|
||||
if (origin_)
|
||||
return origin_->frame()->texture();
|
||||
else
|
||||
return Resource::getTextureBlack();
|
||||
return Resource::getTextureBlack();
|
||||
}
|
||||
|
||||
void CloneSource::accept(Visitor& v)
|
||||
|
||||
@@ -1043,11 +1043,18 @@ void ImGuiVisitor::visit (CloneSource& s)
|
||||
}
|
||||
|
||||
// link to origin source
|
||||
std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name();
|
||||
if (ImGui::Button(label.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ))
|
||||
Mixer::manager().setCurrentSource(s.origin());
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Origin");
|
||||
if ( !s.failed() ) {
|
||||
std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name();
|
||||
if (ImGui::Button(label.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ))
|
||||
Mixer::manager().setCurrentSource(s.origin());
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Origin");
|
||||
}
|
||||
else {
|
||||
ImGuiToolkit::ButtonDisabled("No source", ImVec2(IMGUI_RIGHT_ALIGN, 0) );
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("Origin");
|
||||
}
|
||||
|
||||
// filter selection
|
||||
std::ostringstream oss;
|
||||
|
||||
@@ -223,12 +223,12 @@ void InfoVisitor::visit (RenderSource& s)
|
||||
|
||||
void InfoVisitor::visit (CloneSource& s)
|
||||
{
|
||||
if (current_id_ == s.id() || s.origin() == nullptr)
|
||||
if (current_id_ == s.id() && !s.failed())
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
|
||||
if (s.frame()){
|
||||
if (!s.failed() && s.frame()){
|
||||
if (brief_) {
|
||||
oss << (s.frame()->flags() & FrameBuffer::FrameBuffer_alpha ? "RGBA, " : "RGB, ");
|
||||
oss << s.frame()->width() << " x " << s.frame()->height();
|
||||
@@ -241,6 +241,8 @@ void InfoVisitor::visit (CloneSource& s)
|
||||
oss << s.frame()->width() << " x " << s.frame()->height();
|
||||
}
|
||||
}
|
||||
else
|
||||
oss << "Undefined";
|
||||
|
||||
information_ = oss.str();
|
||||
current_id_ = s.id();
|
||||
|
||||
@@ -247,13 +247,14 @@ void Session::update(float dt)
|
||||
// insert source in list of failed
|
||||
// (NB: insert in set fails if source is already listed)
|
||||
failed_.insert( *it );
|
||||
// do not render
|
||||
render_.scene.ws()->detach( (*it)->group(View::RENDERING) );
|
||||
}
|
||||
// render normally
|
||||
else {
|
||||
// session is not ready if one source is not ready
|
||||
if ( !(*it)->ready() )
|
||||
ready = false;
|
||||
// set inputs
|
||||
|
||||
// update the source
|
||||
(*it)->setActive(activation_threshold_);
|
||||
(*it)->update(dt);
|
||||
|
||||
Reference in New Issue
Block a user