BugFix Prevent warnings gstreamer

This commit is contained in:
Bruno Herbelin
2024-10-04 19:23:16 +02:00
parent 21bb2af7ea
commit 10e95f5388
3 changed files with 20 additions and 38 deletions

View File

@@ -163,11 +163,12 @@ void Device::add(GstDevice *device)
auto handle = std::find_if(handles_.cbegin(), handles_.cend(), hasDeviceName(device_name) ); auto handle = std::find_if(handles_.cbegin(), handles_.cend(), hasDeviceName(device_name) );
if ( handle == handles_.cend() ) { if ( handle == handles_.cend() ) {
std::string p = pipelineForDevice(device, handles_.size());
GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(p);
// add if not in the list and valid // add if not in the list and valid
if (!p.empty() && !confs.empty()) { std::string p = pipelineForDevice(device, handles_.size());
if (!p.empty()) {
GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(p);
if (!confs.empty()) {
DeviceHandle dev; DeviceHandle dev;
dev.name = device_name; dev.name = device_name;
dev.pipeline = p; dev.pipeline = p;
@@ -180,7 +181,7 @@ void Device::add(GstDevice *device)
handles_.push_back(dev); handles_.push_back(dev);
Log::Info("Device '%s' is plugged-in.", device_name); Log::Info("Device '%s' is plugged-in.", device_name);
} }
}
} }
// unlock access // unlock access
access_.unlock(); access_.unlock();

View File

@@ -18,14 +18,9 @@
**/ **/
#include <algorithm> #include <algorithm>
#include <thread>
#include <chrono> #include <chrono>
#include <sstream> #include <sstream>
#include <glm/gtc/matrix_transform.hpp> #include <thread>
#include <gst/pbutils/gstdiscoverer.h>
#include <gst/pbutils/pbutils.h>
#include <gst/gst.h>
#include "Log.h" #include "Log.h"
#include "Decorations.h" #include "Decorations.h"
@@ -47,7 +42,7 @@ std::string gst_plugin_vidcap = "ximagesrc show-pointer=false";
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xproto.h> #include <xcb/xproto.h>
int X11_error_handler(Display *d, XErrorEvent *e); int X11_error_handler(Display *d, XErrorEvent *e);
std::map<unsigned long, std::string> getListX11Windows(); std::map<unsigned long, std::string> getListX11Windows();
@@ -87,18 +82,6 @@ private:
void ScreenCaptureHandle::update(const std::string &newname) void ScreenCaptureHandle::update(const std::string &newname)
{ {
GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(pipeline);
if (!confs.empty()) {
GstToolkit::PipelineConfig best = *confs.rbegin();
GstToolkit::PipelineConfigSet confscreen;
// limit framerate to 30fps
best.fps_numerator = MIN( best.fps_numerator, 30);
best.fps_denominator = 1;
confscreen.insert(best);
configs = confscreen;
}
name = newname; name = newname;
} }
@@ -159,7 +142,7 @@ void ScreenCapture::remove(const std::string &windowname, unsigned long id)
// just inform if there is no source connected // just inform if there is no source connected
if (handle->associated_sources.empty()) { if (handle->associated_sources.empty()) {
Log::Info("Window %s closed.", windowname.c_str()); Log::Info("Window %s available.", windowname.c_str());
} }
else { else {
// otherwise unplug all sources and close their streams // otherwise unplug all sources and close their streams

View File

@@ -4,8 +4,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <set>
#include <map>
#include "GstToolkit.h" #include "GstToolkit.h"
#include "StreamSource.h" #include "StreamSource.h"