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