video_rxtx: make API functions noexcept

This commit is contained in:
Martin Pulec
2023-09-27 10:10:57 +02:00
parent a4d4aab9d3
commit 500fc0aeb1
13 changed files with 44 additions and 38 deletions

View File

@@ -101,8 +101,8 @@ protected:
unsigned long long int m_frames_sent;
private:
void start();
virtual void send_frame(std::shared_ptr<video_frame>) = 0;
virtual void *(*get_receiver_thread())(void *arg) = 0;
virtual void send_frame(std::shared_ptr<video_frame>) noexcept = 0;
virtual void *(*get_receiver_thread() noexcept)(void *arg) = 0;
static void *sender_thread(void *args);
void *sender_loop();
virtual struct response *process_sender_message(struct msg_sender *) {

View File

@@ -81,7 +81,8 @@ h264_rtp_video_rxtx::h264_rtp_video_rxtx(std::map<std::string, param_u> const &p
#endif
}
void h264_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
void
h264_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
{
tx_send_h264(m_tx, tx_frame.get(), m_network_device);
if ((m_rxtx_mode & MODE_RECEIVER) == 0) { // send RTCP (receiver thread would otherwise do this

View File

@@ -7,7 +7,7 @@
*/
/*
* Copyright (c) 2013-2014 Fundació i2CAT, Internet I Innovació Digital a Catalunya
* Copyright (c) 2013-2014 CESNET, z. s. p. o.
* Copyright (c) 2013-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,8 @@ public:
h264_rtp_video_rxtx(std::map<std::string, param_u> const &, int);
virtual ~h264_rtp_video_rxtx();
private:
virtual void send_frame(std::shared_ptr<video_frame>);
virtual void *(*get_receiver_thread())(void *arg) {
virtual void send_frame(std::shared_ptr<video_frame>) noexcept override;
virtual void *(*get_receiver_thread() noexcept)(void *arg) override {
return NULL;
}
rtsp_serv_t *m_rtsp_server;

View File

@@ -114,7 +114,8 @@ void h264_sdp_video_rxtx::sdp_add_video(codec_t codec)
* producing H.264/JPEG natively (eg. v4l2) to be passed untouched to transport. Fallback H.264 is applied when uncompressed
* stream is detected.
*/
void h264_sdp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
void
h264_sdp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
{
if (!is_codec_opaque(tx_frame->color_spec)) {
if (m_sent_compress_change) {

View File

@@ -54,8 +54,8 @@ public:
virtual ~h264_sdp_video_rxtx();
private:
static void change_address_callback(void *udata, const char *address);
virtual void send_frame(std::shared_ptr<video_frame>);
virtual void *(*get_receiver_thread())(void *arg) {
virtual void send_frame(std::shared_ptr<video_frame>) noexcept override;
virtual void *(*get_receiver_thread() noexcept)(void *arg) override {
return NULL;
}
void sdp_add_video(codec_t codec);

View File

@@ -10,7 +10,7 @@
* Dalibor Matura <255899@mail.muni.cz>
* Ian Wesley-Smith <iwsmith@cct.lsu.edu>
*
* Copyright (c) 2005-2010 CESNET z.s.p.o.
* Copyright (c) 2005-2023 CESNET z.s.p.o.
* Copyright (c) 2001-2004 University of Southern California
* Copyright (c) 2003-2004 University of Glasgow
*
@@ -71,7 +71,8 @@
using namespace std;
void ihdtv_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
void
ihdtv_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
{
#ifdef HAVE_IHDTV
ihdtv_send(&m_tx_connection, tx_frame.get(), 9000000); // FIXME: fix the use of frame size!!

View File

@@ -11,7 +11,7 @@
* Ian Wesley-Smith <iwsmith@cct.lsu.edu>
* Martin Pulec <pulec@cesnet.cz>
*
* Copyright (c) 2005-2010 CESNET z.s.p.o.
* Copyright (c) 2005-2023 CESNET z.s.p.o.
* Copyright (c) 2001-2004 University of Southern California
* Copyright (c) 2003-2004 University of Glasgow
*
@@ -70,12 +70,12 @@ public:
ihdtv_video_rxtx(std::map<std::string, param_u> const &);
~ihdtv_video_rxtx();
private:
void send_frame(std::shared_ptr<video_frame>);
void send_frame(std::shared_ptr<video_frame>) noexcept override;
static void *receiver_thread(void *arg) {
ihdtv_video_rxtx *s = static_cast<ihdtv_video_rxtx *>(arg);
return s->receiver_loop();
}
void *(*get_receiver_thread())(void *arg) {
void *(*get_receiver_thread() noexcept)(void *arg) override {
return receiver_thread;
}
void *receiver_loop();

View File

@@ -3,7 +3,7 @@
* @author Martin Pulec <pulec@cesnet.cz>
*/
/*
* Copyright (c) 2018 CESNET, z. s. p. o.
* Copyright (c) 2018-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
#include "config_win32.h"
#endif // HAVE_CONFIG_H
#include "video_rxtx/loopback.h"
#include "video_rxtx/loopback.hpp"
#include <chrono>
@@ -81,7 +81,8 @@ void *loopback_video_rxtx::receiver_thread(void *arg)
return s->receiver_loop();
}
void loopback_video_rxtx::send_frame(std::shared_ptr<video_frame> f)
void
loopback_video_rxtx::send_frame(std::shared_ptr<video_frame> f) noexcept
{
unique_lock<mutex> lk(m_lock);
if (m_frames.size() >= BUFF_MAX_LEN) {
@@ -91,7 +92,6 @@ void loopback_video_rxtx::send_frame(std::shared_ptr<video_frame> f)
m_frames.push(f);
lk.unlock();
m_frame_ready.notify_one();
}
void *loopback_video_rxtx::receiver_loop()
@@ -123,7 +123,7 @@ void *loopback_video_rxtx::receiver_loop()
return nullptr;
}
void *(*loopback_video_rxtx::get_receiver_thread())(void *arg)
void *(*loopback_video_rxtx::get_receiver_thread() noexcept)(void *arg)
{
return receiver_thread;
}

View File

@@ -1,9 +1,9 @@
/**
* @file video_rxtx/ultragrid_rtp.h
* @file video_rxtx/loopback.hpp
* @author Martin Pulec <pulec@cesnet.cz>
*/
/*
* Copyright (c) 2018 CESNET, z. s. p. o.
* Copyright (c) 2018-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,8 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VIDEO_RXTX_LOOPBACK_H
#define VIDEO_RXTX_LOOPBACK_H
#ifndef VIDEO_RXTX_LOOPBACK_HPP
#define VIDEO_RXTX_LOOPBACK_HPP
#include <condition_variable>
#include <memory>
@@ -55,9 +55,9 @@ public:
private:
static void *receiver_thread(void *arg);
virtual void send_frame(std::shared_ptr<video_frame>) override;
virtual void send_frame(std::shared_ptr<video_frame>) noexcept override;
void *receiver_loop();
virtual void *(*get_receiver_thread())(void *arg) override;
virtual void *(*get_receiver_thread() noexcept)(void *arg) override;
struct display *m_display_device;
struct video_desc m_configure_desc{};
@@ -66,5 +66,5 @@ private:
std::mutex m_lock;
};
#endif // VIDEO_RXTX_LOOPBACK_H
#endif // !defined VIDEO_RXTX_LOOPBACK_HPP

View File

@@ -3,7 +3,7 @@
* @author Martin Pulec <pulec@cesnet.cz>
*/
/*
* Copyright (c) 2013-2014 CESNET z.s.p.o.
* Copyright (c) 2013-2023 CESNET z.s.p.o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,10 +74,11 @@ sage_video_rxtx::sage_video_rxtx(map<string, param_u> const &params) :
memset(&m_saved_video_desc, 0, sizeof(m_saved_video_desc));
}
void sage_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
void
sage_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
{
if(!video_desc_eq(m_saved_video_desc,
video_desc_from_frame(tx_frame.get()))) {
if (!video_desc_eq(m_saved_video_desc,
video_desc_from_frame(tx_frame.get()))) {
display_reconfigure(m_sage_tx_device,
video_desc_from_frame(tx_frame.get()), VIDEO_NORMAL);
m_saved_video_desc = video_desc_from_frame(tx_frame.get());

View File

@@ -3,7 +3,7 @@
* @author Martin Pulec <martin.pulec@cesnet.cz>
*/
/*
* Copyright (c) 2014 CESNET, z. s. p. o.
* Copyright (c) 2014-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,8 @@ public:
sage_video_rxtx(std::map<std::string, param_u> const &);
~sage_video_rxtx();
private:
void send_frame(std::shared_ptr<video_frame>);
void *(*get_receiver_thread())(void *arg) {
void send_frame(std::shared_ptr<video_frame>) noexcept override;
void *(*get_receiver_thread() noexcept)(void *arg) override {
return NULL;
}
struct video_desc m_saved_video_desc;

View File

@@ -115,11 +115,13 @@ void *ultragrid_rtp_video_rxtx::receiver_thread(void *arg) {
return s->receiver_loop();
}
void *(*ultragrid_rtp_video_rxtx::get_receiver_thread())(void *arg) {
void *(*ultragrid_rtp_video_rxtx::get_receiver_thread() noexcept)(void *arg)
{
return receiver_thread;
}
void ultragrid_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame)
void
ultragrid_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
{
m_video_desc = video_desc_from_frame(tx_frame.get());
if (m_fec_state) {

View File

@@ -3,7 +3,7 @@
* @author Martin Pulec <pulec@cesnet.cz>
*/
/*
* Copyright (c) 2013-2014 CESNET z.s.p.o.
* Copyright (c) 2013-2023 CESNET z.s.p.o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,11 +60,11 @@ public:
friend ssize_t hd_rum_decompress_write(void *state, void *buf, size_t count);
private:
static void *receiver_thread(void *arg);
virtual void send_frame(std::shared_ptr<video_frame>);
virtual void send_frame(std::shared_ptr<video_frame>) noexcept override;
void *receiver_loop();
static void *send_frame_async_callback(void *arg);
virtual void send_frame_async(std::shared_ptr<video_frame>);
virtual void *(*get_receiver_thread())(void *arg);
virtual void *(*get_receiver_thread() noexcept)(void *arg) override;
void receiver_process_messages();
void remove_display_from_decoders();