diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 35cb404eec346d0fc61d5b89f4b4f60c663b098c..6b0f19f7cac65b8ea27f8f3f2fe497cca38b5691 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,8 +47,6 @@ list (APPEND Source_Files "${CMAKE_CURRENT_SOURCE_DIR}/ring_types.h" "${CMAKE_CURRENT_SOURCE_DIR}/scheduled_executor.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/scheduled_executor.h" - "${CMAKE_CURRENT_SOURCE_DIR}/smartools.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/smartools.h" "${CMAKE_CURRENT_SOURCE_DIR}/string_utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/string_utils.h" "${CMAKE_CURRENT_SOURCE_DIR}/threadloop.cpp" diff --git a/src/Makefile.am b/src/Makefile.am index deaf5dd1f6b0b14258ddb86056b5b5e0e0fb1097..8d322d8443e2c660a88c52b88df015943b7e2439 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -109,8 +109,6 @@ libjami_la_SOURCES = \ map_utils.h \ ring_api.cpp \ rational.h \ - smartools.cpp \ - smartools.h \ base64.h \ base64.cpp \ data_transfer.cpp \ diff --git a/src/client/callmanager.cpp b/src/client/callmanager.cpp index a336fde4f29d5b5432da16d323dce7eaaa459219..c83499e07231601f611adb584b58a1865498853d 100644 --- a/src/client/callmanager.cpp +++ b/src/client/callmanager.cpp @@ -37,8 +37,6 @@ #include "manager.h" #include "jamidht/jamiaccount.h" -#include "smartools.h" - namespace libjami { void @@ -226,13 +224,13 @@ isConferenceParticipant(const std::string& accountId, const std::string& callId) void startSmartInfo(uint32_t refreshTimeMs) { - jami::Smartools::getInstance().start(std::chrono::milliseconds(refreshTimeMs)); + JAMI_WARNING("startSmartInfo is deprecated and does nothing."); } void stopSmartInfo() { - jami::Smartools::getInstance().stop(); + JAMI_WARNING("stopSmartInfo is deprecated and does nothing."); } bool diff --git a/src/media/audio/audio_input.cpp b/src/media/audio/audio_input.cpp index 9f54c7946a2dce6f632f2fda3611f0a07782fceb..afadca5c479d99a5b79ed5839432e662e7899587 100644 --- a/src/media/audio/audio_input.cpp +++ b/src/media/audio/audio_input.cpp @@ -28,7 +28,6 @@ #include "resampler.h" #include "ringbuffer.h" #include "ringbufferpool.h" -#include "smartools.h" #include "tracepoint.h" #include <future> diff --git a/src/media/audio/audio_receive_thread.cpp b/src/media/audio/audio_receive_thread.cpp index 76b59c32faaeec98c1dc859f6a52b8615690c4fc..5c948bfd912c6c6ae2346dda4207e2f6be94465d 100644 --- a/src/media/audio/audio_receive_thread.cpp +++ b/src/media/audio/audio_receive_thread.cpp @@ -28,7 +28,6 @@ #include "media_recorder.h" #include "ringbuffer.h" #include "ringbufferpool.h" -#include "smartools.h" #include <memory> @@ -86,7 +85,6 @@ AudioReceiveThread::setup() JAMI_ERR("decoder IO startup failed"); return false; } - Smartools::getInstance().setRemoteAudioCodec(audioDecoder_->getDecoderName()); ringbuffer_ = Manager::instance().getRingBufferPool().getRingBuffer(id_); diff --git a/src/media/audio/audio_rtp_session.cpp b/src/media/audio/audio_rtp_session.cpp index 478bf4bdd06da32188e93fa720861a63eec7af58..f656897a25b994e9f9de397cdb9925746abd99d2 100644 --- a/src/media/audio/audio_rtp_session.cpp +++ b/src/media/audio/audio_rtp_session.cpp @@ -43,7 +43,6 @@ #include "client/videomanager.h" #include "manager.h" #include "observer.h" -#include "smartools.h" #include <sstream> namespace jami { diff --git a/src/media/audio/audio_sender.cpp b/src/media/audio/audio_sender.cpp index be7728a0a28f8dd215d3383696f187c9d8a3b940..74249b5c4036818c85a9b35acb3011307e051df3 100644 --- a/src/media/audio/audio_sender.cpp +++ b/src/media/audio/audio_sender.cpp @@ -27,7 +27,6 @@ #include "media_io_handle.h" #include "media_stream.h" #include "resampler.h" -#include "smartools.h" #include <memory> @@ -75,9 +74,6 @@ AudioSender::setup(SocketPair& socketPair) JAMI_ERR("%s", e.what()); return false; } - - Smartools::getInstance().setLocalAudioCodec(audioEncoder_->getAudioCodec()); - #ifdef DEBUG_SDP audioEncoder_->print_sdp(); #endif diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp index 9b5d2545c70185709a5eff8f379dc2ed1f9f7df7..b2b7ea999da88610ce7b6c019f1f16b79051a287 100644 --- a/src/media/video/sinkclient.cpp +++ b/src/media/video/sinkclient.cpp @@ -37,7 +37,6 @@ #include "jami/videomanager_interface.h" #include "libav_utils.h" #include "video_scaler.h" -#include "smartools.h" #include "media_filter.h" #include "filter_transpose.h" @@ -422,8 +421,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/, ++frameCount_; if (seconds > std::chrono::seconds(1)) { auto fps = frameCount_ / std::chrono::duration<double>(seconds).count(); - // Send the framerate in smartInfo - Smartools::getInstance().setFrameRate(id_, std::to_string(fps)); + JAMI_WARNING("Sink {}, {} FPS", id_, fps); frameCount_ = 0; lastFrameDebug_ = currentTime; } diff --git a/src/media/video/video_receive_thread.cpp b/src/media/video/video_receive_thread.cpp index 490d2e4023e0b10a4dbb78b6e1742ff98dde246f..161d117a3a4006d40c480b48d94e80efd2c290f8 100644 --- a/src/media/video/video_receive_thread.cpp +++ b/src/media/video/video_receive_thread.cpp @@ -28,7 +28,6 @@ #include "client/videomanager.h" #include "sinkclient.h" #include "logger.h" -#include "smartools.h" extern "C" { #include <libavutil/display.h> @@ -246,12 +245,6 @@ VideoReceiveThread::configureVideoOutput() if (useSink_) startSink(); - // Send remote video codec in SmartInfo - Smartools::getInstance().setRemoteVideoCodec(videoDecoder_->getDecoderName(), id_); - - // Send the resolution in smartInfo - Smartools::getInstance().setResolution(id_, dstWidth_, dstHeight_); - if (onSuccessfulSetup_) onSuccessfulSetup_(MEDIA_VIDEO, 1); diff --git a/src/media/video/video_sender.cpp b/src/media/video/video_sender.cpp index cf0aaeb85f40fc0d239f9be3082d6d2a3ef90b49..6bb5588efd5741db372217992a7ce4bfbd0a5612 100644 --- a/src/media/video/video_sender.cpp +++ b/src/media/video/video_sender.cpp @@ -28,7 +28,6 @@ #include "logger.h" #include "manager.h" #include "media_device.h" -#include "smartools.h" #include "sip/sipcall.h" #ifdef RING_ACCEL #include "accel.h" @@ -63,10 +62,6 @@ VideoSender::VideoSender(const std::string& dest, videoEncoder_->addStream(args.codec->systemCodecInfo); videoEncoder_->setInitSeqVal(seqVal); videoEncoder_->setIOContext(muxContext_->getContext()); - // Send local video codec in SmartInfo - Smartools::getInstance().setLocalVideoCodec(videoEncoder_->getVideoCodec()); - // Send the resolution in smartInfo - Smartools::getInstance().setResolution("local", opts.width, opts.height); } void diff --git a/src/meson.build b/src/meson.build index b0b5b08d658b3c67c36f02e033104a38f74464fb..9dd33839c7f0360f0ee862f8d9c2ad399e4cc1c5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -123,7 +123,6 @@ libjami_sources = files( 'sip/siptransport.cpp', 'sip/sipvoiplink.cpp', 'scheduled_executor.cpp', - 'smartools.cpp', 'string_utils.cpp', 'threadloop.cpp', 'uri.cpp', diff --git a/src/smartools.cpp b/src/smartools.cpp deleted file mode 100644 index e8307deb346f78555e6ff3522c77a70fd02758a8..0000000000000000000000000000000000000000 --- a/src/smartools.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2004-2022 Savoir-faire Linux Inc. - * - * Author: Olivier Grégoire <olivier.gregoire@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#include "smartools.h" -#include "manager.h" -#include "jami/callmanager_interface.h" -#include "client/ring_signal.h" - -namespace jami { - -Smartools& -Smartools::getInstance() -{ - // Meyers-Singleton - static Smartools instance_; - return instance_; -} - -Smartools::~Smartools() -{ - stop(); -} - -void -Smartools::sendInfo() -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - emitSignal<libjami::CallSignal::SmartInfo>(information_); - information_.clear(); -} - -void -Smartools::start(std::chrono::milliseconds refreshTimeMs) -{ - JAMI_DBG("Start SmartInfo"); - auto task = Manager::instance().scheduler().scheduleAtFixedRate( - [this] { - sendInfo(); - return true; - }, - refreshTimeMs); - task_.swap(task); - if (task) - task->cancel(); -} - -void -Smartools::stop() -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - JAMI_DBG("Stop SmartInfo"); - if (auto t = std::move(task_)) - t->cancel(); - information_.clear(); -} - -// Set all the information in the map - -void -Smartools::setFrameRate(const std::string& id, const std::string& fps) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - if (id == "local") { - information_["local FPS"] = fps; - } else { - information_["remote FPS"] = fps; - } -} - -void -Smartools::setResolution(const std::string& id, int width, int height) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - if (id == "local") { - information_["local width"] = std::to_string(width); - information_["local height"] = std::to_string(height); - } else { - information_["remote width"] = std::to_string(width); - information_["remote height"] = std::to_string(height); - } -} - -void -Smartools::setRemoteAudioCodec(const std::string& remoteAudioCodec) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - information_["remote audio codec"] = remoteAudioCodec; -} - -void -Smartools::setLocalAudioCodec(const std::string& localAudioCodec) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - information_["local audio codec"] = localAudioCodec; -} - -void -Smartools::setLocalVideoCodec(const std::string& localVideoCodec) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - information_["local video codec"] = localVideoCodec; -} - -void -Smartools::setRemoteVideoCodec(const std::string& remoteVideoCodec, const std::string& callID) -{ - std::lock_guard<std::mutex> lk(mutexInfo_); - information_["remote video codec"] = remoteVideoCodec; - if (auto call = Manager::instance().getCallFromCallID(callID)) { - if (auto conf = call->getConference()) { - information_["type"] = "conference"; - information_["callID"] = conf->getConfId(); - } else { - information_["type"] = "no conference"; - information_["callID"] = callID; - } - } -} - -} // end namespace jami diff --git a/src/smartools.h b/src/smartools.h deleted file mode 100644 index 27d6c2b68f019d1ec640ed42d565c2cdc2337193..0000000000000000000000000000000000000000 --- a/src/smartools.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2004-2022 Savoir-faire Linux Inc. - * - * Author: Olivier Grégoire <olivier.gregoire@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include <string> -#include <chrono> -#include <mutex> -#include <map> -#include <memory> - -namespace jami { -class RepeatedTask; - -class Smartools -{ -// Use for the unit tests -#ifdef TESTING - friend class SmartoolsTest; -#endif - -public: - static Smartools& getInstance(); - void start(std::chrono::milliseconds refreshTimeMs); - void stop(); - void setFrameRate(const std::string& id, const std::string& fps); - void setResolution(const std::string& id, int width, int height); - void setLocalVideoCodec(const std::string& localVideoCodec); - void setRemoteVideoCodec(const std::string& remoteVideoCodec, const std::string& callID); - void setRemoteAudioCodec(const std::string& remoteAudioCodec); - void setLocalAudioCodec(const std::string& remoteAudioCodec); - void sendInfo(); - -private: - Smartools() {}; - ~Smartools(); - std::mutex mutexInfo_; // Protect information_ from multithreading - std::map<std::string, std::string> information_; - std::shared_ptr<RepeatedTask> task_; -}; -} // namespace jami