From ed392d2719a3b84ee7587b751e34dc5bb695d0a3 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Fri, 31 Jan 2020 23:10:04 +0100 Subject: [PATCH] Improved handling of update source and update sink operation in case of failure. Changed WebUI to reload the list of sources and sinks also in case editing is cancelled. --- daemon/session_manager.cpp | 8 +++++++- webui/src/Sinks.js | 1 + webui/src/Sources.js | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/daemon/session_manager.cpp b/daemon/session_manager.cpp index 450aa0d..25a3df4 100644 --- a/daemon/session_manager.cpp +++ b/daemon/session_manager.cpp @@ -254,7 +254,7 @@ bool SessionManager::parse_sdp(const std::string sdp, StreamInfo& info) const { } case 'c': /* c=IN IP4 239.1.0.12/15 */ - /* connction info of audio media */ + /* connection info of audio media */ if (status == sdp_parser_status::media) { std::vector fields; boost::split(fields, val, @@ -494,6 +494,9 @@ std::error_code SessionManager::add_source(const StreamSource& source) { if (info.enabled) { ret = driver_->add_rtp_stream(info.stream, info.handle); if (ret) { + if (it != sources_.end()) { + sources_.erase(source.id); + } return ret; } igmp_.join(config_->get_ip_addr_str(), @@ -709,6 +712,9 @@ std::error_code SessionManager::add_sink(const StreamSink& sink) { auto ret = driver_->add_rtp_stream(info.stream, info.handle); if (ret) { + if (it != sinks_.end()) { + sinks_.erase(sink.id); + } return ret; } diff --git a/webui/src/Sinks.js b/webui/src/Sinks.js index f2916f9..389c38f 100644 --- a/webui/src/Sinks.js +++ b/webui/src/Sinks.js @@ -193,6 +193,7 @@ class Sinks extends Component { closeEdit() { this.setState({editIsOpen: false}); this.setState({removeIsOpen: false}); + this.fetchSinks(); } onEditClick(id) { diff --git a/webui/src/Sources.js b/webui/src/Sources.js index 5fdf8c4..e4aa3c5 100644 --- a/webui/src/Sources.js +++ b/webui/src/Sources.js @@ -170,6 +170,7 @@ class Sources extends Component { closeEdit() { this.setState({editIsOpen: false}); this.setState({removeIsOpen: false}); + this.fetchSources(); } onEditClick(id) {