From 0f8948433bf57d666094a788fa810b9b42ad9614 Mon Sep 17 00:00:00 2001 From: Adrien Beraud <adrien.beraud@savoirfairelinux.com> Date: Sun, 8 Jan 2023 15:29:07 -0500 Subject: [PATCH] remove SmartInfo API is preserved for now, but deprecated and does nothing. Change-Id: I92854e1eaf79476b3d9e17487e5dff691241e3fc --- src/CMakeLists.txt | 2 - src/Makefile.am | 2 - src/client/callmanager.cpp | 6 +- src/media/audio/audio_input.cpp | 1 - src/media/audio/audio_receive_thread.cpp | 2 - src/media/audio/audio_rtp_session.cpp | 1 - src/media/audio/audio_sender.cpp | 4 - src/media/video/sinkclient.cpp | 4 +- src/media/video/video_receive_thread.cpp | 7 -- src/media/video/video_sender.cpp | 5 - src/meson.build | 1 - src/smartools.cpp | 136 ----------------------- src/smartools.h | 57 ---------- 13 files changed, 3 insertions(+), 225 deletions(-) delete mode 100644 src/smartools.cpp delete mode 100644 src/smartools.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 35cb404eec..6b0f19f7ca 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 deaf5dd1f6..8d322d8443 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 a336fde4f2..c83499e072 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 9f54c7946a..afadca5c47 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 76b59c32fa..5c948bfd91 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 478bf4bdd0..f656897a25 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 be7728a0a2..74249b5c40 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 9b5d2545c7..b2b7ea999d 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 490d2e4023..161d117a3a 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 cf0aaeb85f..6bb5588efd 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 b0b5b08d65..9dd33839c7 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 e8307deb34..0000000000 --- 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 27d6c2b68f..0000000000 --- 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 -- GitLab