Skip to content

Commit 24522b3

Browse files
committed
rtp_rxtx_common: hide member "used"
1 parent d703c4e commit 24522b3

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/video_rxtx/h264_rtp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ h264_rtp_video_rxtx::configure_rtsp_server_video()
128128
void
129129
h264_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
130130
{
131-
rtp_process_sender_messages(m_rtp_common);
131+
rtp_rxtx_sender_do_housekeeping(m_rtp_common);
132132
// requestt compress reconfiguration if receivng raw data
133133
if (!is_codec_opaque(tx_frame->color_spec)) {
134134
if (!m_sent_compress_change) {

src/video_rxtx/h264_sdp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "utils/sdp.h"
6262
#include "video_codec.h" // for is_codec_opaque
6363
#include "video_rxtx.h"
64+
#include "video_rxtx/rtp.hpp"
6465

6566
#define DEFAULT_SDP_COMPRESSION "lavc:codec=MJPG:safe"
6667
#define MOD_NAME "[vrxtx/sdp] "
@@ -127,7 +128,7 @@ void h264_sdp_video_rxtx::sdp_add_video(codec_t codec)
127128
void
128129
h264_sdp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
129130
{
130-
rtp_process_sender_messages(m_rtp_common);
131+
rtp_rxtx_sender_do_housekeeping(m_rtp_common);
131132
if (!is_codec_opaque(tx_frame->color_spec)) {
132133
if (m_sent_compress_change) {
133134
return;

src/video_rxtx/rtp.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ struct rtp_rxtx_common_priv_state {
8787
/// message and also the send/receive handling is not entirely
8888
/// symetric).
8989
struct module m_rtp_sender_mod;
90+
91+
bool used;
9092
};
9193

9294
static struct rtp *initialize_network(const char *addr, int recv_port,
@@ -166,7 +168,7 @@ rtp_process_sender_message(struct rtp_rxtx_common *s, struct msg_sender *msg)
166168

167169
// Exit only if we failed because of command line
168170
// params, not control port msg
169-
if (s->used) {
171+
if (s->priv->used) {
170172
exit_uv(rc);
171173
}
172174

@@ -210,8 +212,10 @@ rtp_process_sender_message(struct rtp_rxtx_common *s, struct msg_sender *msg)
210212
return new_response(RESPONSE_OK, nullptr);
211213
}
212214

213-
void rtp_process_sender_messages(struct rtp_rxtx_common *s)
215+
void rtp_rxtx_sender_do_housekeeping(struct rtp_rxtx_common *s)
214216
{
217+
s->priv->used = true;
218+
215219
struct message *msg_external = nullptr;
216220
while ((msg_external = check_message(&s->priv->m_rtp_sender_mod)) !=
217221
nullptr) {
@@ -266,7 +270,7 @@ struct rtp_rxtx_common *rtp_rxtx_common_init(const struct vrxtx_params *params,
266270
// The idea of doing that is to display help on '-f ldgm:help' even if UG would exit
267271
// immediately. The encoder is actually created by a message.
268272
// Also for `-x sdp:help` the message will get discarded and the warning that message quie
269-
rtp_process_sender_messages(s);
273+
rtp_rxtx_sender_do_housekeeping(s);
270274

271275
return s;
272276
}

src/video_rxtx/rtp.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ struct rtp_rxtx_common {
5959
struct pdb *participants;
6060
struct fec *fec_state;
6161
int rxtx_mode;
62-
bool used; ///< at least one frame was sent
6362
struct rtp_rxtx_common_priv_state *priv;
6463
};
6564

6665
struct rtp_rxtx_common *rtp_rxtx_common_init(const struct vrxtx_params *params,
6766
const struct common_opts *common);
6867
void rtp_rxtx_common_done(struct rtp_rxtx_common *state);
6968

70-
void rtp_process_sender_messages(struct rtp_rxtx_common *s);
69+
void rtp_rxtx_sender_do_housekeeping(struct rtp_rxtx_common *s);
7170
void rtp_rxtx_set_pbuf_delay(struct rtp_rxtx_common *s, double delay);
7271

7372

src/video_rxtx/ultragrid_rtp.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ void *ultragrid_rtp_video_rxtx::receiver_thread(void *arg) {
127127
void
128128
ultragrid_rtp_video_rxtx::send_frame(shared_ptr<video_frame> tx_frame) noexcept
129129
{
130-
rtp_process_sender_messages(m_rtp_common);
131-
m_rtp_common->used = true;
130+
rtp_rxtx_sender_do_housekeeping(m_rtp_common);
132131
if (m_rtp_common->fec_state != nullptr) {
133132
tx_frame = m_rtp_common->fec_state->encode(tx_frame);
134133
}

0 commit comments

Comments
 (0)