BugFix Stream sources change input

This commit is contained in:
Bruno Herbelin
2023-09-17 12:17:41 +02:00
parent 33c222555f
commit a430d39849
4 changed files with 17 additions and 5 deletions

View File

@@ -157,6 +157,11 @@ void PatternSource::setPattern(uint type, glm::ivec2 resolution)
// play gstreamer
stream_->play(true);
// delete and reset render buffer to enforce re-init of StreamSource
if (renderbuffer_)
delete renderbuffer_;
renderbuffer_ = nullptr;
// will be ready after init and one frame rendered
ready_ = false;
}

View File

@@ -43,6 +43,11 @@ void SrtReceiverSource::setConnection(const std::string &ip, const std::string &
stream_->open(description);
stream_->play(true);
// delete and reset render buffer to enforce re-init of StreamSource
if (renderbuffer_)
delete renderbuffer_;
renderbuffer_ = nullptr;
// will be ready after init and one frame rendered
ready_ = false;
}

View File

@@ -106,7 +106,7 @@ std::string Stream::decoderName()
guint Stream::texture() const
{
if (!textureindex_)
if (!textureindex_ || !textureinitialized_)
return Resource::getTextureBlack();
return textureindex_;
@@ -202,9 +202,6 @@ StreamInfo StreamDiscoverer(const std::string &description, guint w, guint h)
void Stream::open(const std::string &gstreamer_description, guint w, guint h)
{
if ( w != width_ || h != height_ )
textureinitialized_ = false;
// set gstreamer pipeline source
description_ = gstreamer_description;
@@ -238,6 +235,7 @@ void Stream::execute_open()
{
// reset
opened_ = false;
textureinitialized_ = false;
// Add custom app sink to the gstreamer pipeline
std::string description = description_;
@@ -369,7 +367,6 @@ void Stream::close()
// un-ready
opened_ = false;
textureinitialized_ = false;
// clean up GST
if (pipeline_ != nullptr) {

View File

@@ -51,6 +51,11 @@ void GenericStreamSource::setDescription(const std::string &desc)
stream_->open(gst_description_ + " ! queue max-size-buffers=10 ! videoconvert" );
stream_->play(true);
// delete and reset render buffer to enforce re-init of StreamSource
if (renderbuffer_)
delete renderbuffer_;
renderbuffer_ = nullptr;
// will be ready after init and one frame rendered
ready_ = false;
}