mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Improved user message for stream discovery failure
This commit is contained in:
@@ -157,7 +157,8 @@ StreamInfo StreamDiscoverer(const std::string &description, guint w, guint h)
|
|||||||
// wait for the callback_stream_discoverer to return, no more than 4 sec
|
// wait for the callback_stream_discoverer to return, no more than 4 sec
|
||||||
std::mutex mtx;
|
std::mutex mtx;
|
||||||
std::unique_lock<std::mutex> lck(mtx);
|
std::unique_lock<std::mutex> lck(mtx);
|
||||||
info.discovered.wait_for(lck,std::chrono::seconds(TIMEOUT));
|
if ( info.discovered.wait_for(lck,std::chrono::seconds(TIMEOUT)) == std::cv_status::timeout)
|
||||||
|
info.message = "Time out.";
|
||||||
|
|
||||||
// stop and delete pipeline
|
// stop and delete pipeline
|
||||||
GstStateChangeReturn ret = gst_element_set_state (_pipeline, GST_STATE_NULL);
|
GstStateChangeReturn ret = gst_element_set_state (_pipeline, GST_STATE_NULL);
|
||||||
@@ -166,6 +167,8 @@ StreamInfo StreamDiscoverer(const std::string &description, guint w, guint h)
|
|||||||
gst_object_unref (_pipeline);
|
gst_object_unref (_pipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
info.message = error->message;
|
||||||
}
|
}
|
||||||
// at this point, the info should be filled
|
// at this point, the info should be filled
|
||||||
return info;
|
return info;
|
||||||
@@ -631,7 +634,7 @@ void Stream::update()
|
|||||||
}
|
}
|
||||||
// invalid info; fail
|
// invalid info; fail
|
||||||
else
|
else
|
||||||
fail("Failed to determine resolution");
|
fail("Could not create stream: " + i.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// wait next frame to display
|
// wait next frame to display
|
||||||
|
|||||||
4
Stream.h
4
Stream.h
@@ -15,13 +15,14 @@
|
|||||||
class Visitor;
|
class Visitor;
|
||||||
|
|
||||||
#define N_FRAME 3
|
#define N_FRAME 3
|
||||||
#define TIMEOUT 4
|
#define TIMEOUT 5
|
||||||
|
|
||||||
struct StreamInfo {
|
struct StreamInfo {
|
||||||
|
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
std::condition_variable discovered;
|
std::condition_variable discovered;
|
||||||
|
std::string message;
|
||||||
|
|
||||||
StreamInfo(guint w=0, guint h=0) {
|
StreamInfo(guint w=0, guint h=0) {
|
||||||
width = w;
|
width = w;
|
||||||
@@ -31,6 +32,7 @@ struct StreamInfo {
|
|||||||
StreamInfo(const StreamInfo& b) {
|
StreamInfo(const StreamInfo& b) {
|
||||||
width = b.width;
|
width = b.width;
|
||||||
height = b.height;
|
height = b.height;
|
||||||
|
message = b.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool valid() { return width > 0 && height > 0; }
|
inline bool valid() { return width > 0 && height > 0; }
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ GenericStreamSource::GenericStreamSource(uint64_t id) : StreamSource(id)
|
|||||||
|
|
||||||
void GenericStreamSource::setDescription(const std::string &desc)
|
void GenericStreamSource::setDescription(const std::string &desc)
|
||||||
{
|
{
|
||||||
gst_description_ = desc;
|
gst_description_ = BaseToolkit::unwrapped(desc);
|
||||||
gst_elements_ = BaseToolkit::splitted(desc, '!');
|
gst_elements_ = BaseToolkit::splitted(desc, '!');
|
||||||
Log::Notify("Creating Source with Stream description '%s'", gst_description_.c_str());
|
Log::Notify("Creating Source with Stream description '%s'", gst_description_.c_str());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user