Do not pass socket reference to RTP packet dispatcher's constructor

Packet dispatcher does not need to store the socket because it
is passed to the actual runner when the packet dispatcher is started.

This also fixes a bug where the socket's destructor is called right
after the packet dispatcher's constructor
This commit is contained in:
Aaro Altonen 2020-08-05 09:50:23 +03:00
parent 4acf80b71a
commit ddef2b4c71
3 changed files with 3 additions and 6 deletions

View File

@ -14,7 +14,7 @@ namespace uvg_rtp {
class pkt_dispatcher : public runner {
public:
pkt_dispatcher(uvg_rtp::socket socket);
pkt_dispatcher();
~pkt_dispatcher();
/* Install a generic handler for an incoming packet
@ -53,8 +53,6 @@ namespace uvg_rtp {
static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket *socket, int flags);
private:
uvg_rtp::socket socket_;
std::vector<packet_handler> packet_handlers_;
/* If receive hook has not been installed, frames are pushed to "frames_"

View File

@ -102,7 +102,7 @@ rtp_error_t uvg_rtp::media_stream::init()
return RTP_GENERIC_ERROR;
}
if (!(pkt_dispatcher_ = new uvg_rtp::pkt_dispatcher(socket_)))
if (!(pkt_dispatcher_ = new uvg_rtp::pkt_dispatcher()))
return RTP_MEMORY_ERROR;
if (!(rtp_ = new uvg_rtp::rtp(fmt_))) {

View File

@ -11,8 +11,7 @@
#include "pkt_dispatch.hh"
#include "util.hh"
uvg_rtp::pkt_dispatcher::pkt_dispatcher(uvg_rtp::socket socket):
socket_(socket)
uvg_rtp::pkt_dispatcher::pkt_dispatcher()
{
}