mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-16 04:40:08 +01:00
BugFix stop stream without deleting it
This commit is contained in:
10
Streamer.cpp
10
Streamer.cpp
@@ -155,6 +155,7 @@ void Streaming::setSession(Session *se)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Streaming::removeStream(const std::string &sender, int port)
|
void Streaming::removeStream(const std::string &sender, int port)
|
||||||
{
|
{
|
||||||
// get ip of sender
|
// get ip of sender
|
||||||
@@ -266,7 +267,9 @@ void Streaming::addStream(const std::string &sender, int reply_to, const std::st
|
|||||||
|
|
||||||
// create streamer & remember it
|
// create streamer & remember it
|
||||||
VideoStreamer *streamer = new VideoStreamer(conf);
|
VideoStreamer *streamer = new VideoStreamer(conf);
|
||||||
|
streamers_lock_.lock();
|
||||||
streamers_.push_back(streamer);
|
streamers_.push_back(streamer);
|
||||||
|
streamers_lock_.unlock();
|
||||||
|
|
||||||
// start streamer
|
// start streamer
|
||||||
session_->addFrameGrabber(streamer);
|
session_->addFrameGrabber(streamer);
|
||||||
@@ -285,8 +288,6 @@ VideoStreamer::VideoStreamer(NetworkToolkit::StreamConfig conf): FrameGrabber(),
|
|||||||
|
|
||||||
VideoStreamer::~VideoStreamer()
|
VideoStreamer::~VideoStreamer()
|
||||||
{
|
{
|
||||||
stop();
|
|
||||||
|
|
||||||
if (src_ != nullptr)
|
if (src_ != nullptr)
|
||||||
gst_object_unref (src_);
|
gst_object_unref (src_);
|
||||||
if (pipeline_ != nullptr) {
|
if (pipeline_ != nullptr) {
|
||||||
@@ -424,7 +425,7 @@ void VideoStreamer::addFrame (FrameBuffer *frame_buffer, float dt)
|
|||||||
frame_buffer->height() != height_ ||
|
frame_buffer->height() != height_ ||
|
||||||
frame_buffer->use_alpha() != frame_buffer_->use_alpha()) {
|
frame_buffer->use_alpha() != frame_buffer_->use_alpha()) {
|
||||||
|
|
||||||
stop();
|
Streaming::manager().removeStream(config_.client_address, config_.port);
|
||||||
Log::Warning("Streaming interrupted: new session (%d x %d) incompatible with recording (%d x %d)", frame_buffer->width(), frame_buffer->height(), width_, height_);
|
Log::Warning("Streaming interrupted: new session (%d x %d) incompatible with recording (%d x %d)", frame_buffer->width(), frame_buffer->height(), width_, height_);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -572,7 +573,10 @@ double VideoStreamer::duration()
|
|||||||
|
|
||||||
bool VideoStreamer::busy()
|
bool VideoStreamer::busy()
|
||||||
{
|
{
|
||||||
|
if (streaming_)
|
||||||
return accept_buffer_ ? true : false;
|
return accept_buffer_ ? true : false;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// appsrc needs data and we should start sending
|
// appsrc needs data and we should start sending
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
inline bool enabled() const { return enabled_; }
|
inline bool enabled() const { return enabled_; }
|
||||||
void setSession(Session *se);
|
void setSession(Session *se);
|
||||||
void removeStreams(const std::string &clientname);
|
void removeStreams(const std::string &clientname);
|
||||||
|
void removeStream(const std::string &sender, int port);
|
||||||
|
|
||||||
bool busy();
|
bool busy();
|
||||||
std::vector<std::string> listStreams();
|
std::vector<std::string> listStreams();
|
||||||
@@ -53,7 +54,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void addStream(const std::string &sender, int reply_to, const std::string &clientname);
|
void addStream(const std::string &sender, int reply_to, const std::string &clientname);
|
||||||
void refuseStream(const std::string &sender, int reply_to);
|
void refuseStream(const std::string &sender, int reply_to);
|
||||||
void removeStream(const std::string &sender, int port);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -73,6 +73,8 @@ class VideoStreamer : public FrameGrabber
|
|||||||
{
|
{
|
||||||
friend class Streaming;
|
friend class Streaming;
|
||||||
|
|
||||||
|
void stop() override;
|
||||||
|
|
||||||
// Frame buffer information
|
// Frame buffer information
|
||||||
FrameBuffer *frame_buffer_;
|
FrameBuffer *frame_buffer_;
|
||||||
uint width_;
|
uint width_;
|
||||||
@@ -101,7 +103,6 @@ public:
|
|||||||
~VideoStreamer();
|
~VideoStreamer();
|
||||||
|
|
||||||
void addFrame(FrameBuffer *frame_buffer, float dt) override;
|
void addFrame(FrameBuffer *frame_buffer, float dt) override;
|
||||||
void stop() override;
|
|
||||||
std::string info() override;
|
std::string info() override;
|
||||||
double duration() override;
|
double duration() override;
|
||||||
bool busy() override;
|
bool busy() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user