mirror of
https://github.com/DigitalDevices/pvr.octonet.git
synced 2023-10-10 13:36:57 +02:00
rtsp_client: Open and close rtcp socket as well
This commit is contained in:
parent
2aa320ee2d
commit
415d2c98ac
@ -37,6 +37,7 @@ int asprintf(char **sptr, char *fmt, ...) {
|
|||||||
#define KEEPALIVE_INTERVAL 60
|
#define KEEPALIVE_INTERVAL 60
|
||||||
#define KEEPALIVE_MARGIN 5
|
#define KEEPALIVE_MARGIN 5
|
||||||
#define UDP_ADDRESS_LEN 16
|
#define UDP_ADDRESS_LEN 16
|
||||||
|
#define RTCP_BUFFER_SIZE 1024
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ADDON;
|
using namespace ADDON;
|
||||||
@ -66,12 +67,16 @@ struct rtsp_client {
|
|||||||
|
|
||||||
Socket tcp_sock;
|
Socket tcp_sock;
|
||||||
Socket udp_sock;
|
Socket udp_sock;
|
||||||
|
Socket rtcp_sock;
|
||||||
|
|
||||||
enum rtsp_state state;
|
enum rtsp_state state;
|
||||||
int cseq;
|
int cseq;
|
||||||
|
|
||||||
size_t fifo_size;
|
size_t fifo_size;
|
||||||
uint16_t last_seq_nr;
|
uint16_t last_seq_nr;
|
||||||
|
|
||||||
|
int level;
|
||||||
|
int quality;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct url {
|
struct url {
|
||||||
@ -81,6 +86,16 @@ struct url {
|
|||||||
string path;
|
string path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct rtcp_app {
|
||||||
|
uint8_t subtype;
|
||||||
|
uint8_t pt;
|
||||||
|
uint16_t len;
|
||||||
|
uint32_t ssrc;
|
||||||
|
char name[4];
|
||||||
|
uint16_t identifier;
|
||||||
|
uint16_t string_len;
|
||||||
|
};
|
||||||
|
|
||||||
static rtsp_client *rtsp = NULL;
|
static rtsp_client *rtsp = NULL;
|
||||||
|
|
||||||
static url parse_url(const std::string& str) {
|
static url parse_url(const std::string& str) {
|
||||||
@ -279,6 +294,9 @@ bool rtsp_open(const string& url_str)
|
|||||||
if (rtsp == NULL)
|
if (rtsp == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
rtsp->level = 0;
|
||||||
|
rtsp->quality = 0;
|
||||||
|
|
||||||
kodi->Log(LOG_DEBUG, "try to open '%s'", url_str.c_str());
|
kodi->Log(LOG_DEBUG, "try to open '%s'", url_str.c_str());
|
||||||
|
|
||||||
url dst = parse_url(url_str);
|
url dst = parse_url(url_str);
|
||||||
@ -342,6 +360,14 @@ bool rtsp_open(const string& url_str)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtsp->rtcp_sock = Socket(af_inet, pf_inet, sock_dgram, udp);
|
||||||
|
if(!rtsp->rtcp_sock.bind(rtsp->udp_port + 1)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if(!rtsp->rtcp_sock.set_non_blocking(true)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@ -389,6 +415,7 @@ void rtsp_close()
|
|||||||
rtsp_teardown();
|
rtsp_teardown();
|
||||||
rtsp->tcp_sock.close();
|
rtsp->tcp_sock.close();
|
||||||
rtsp->udp_sock.close();
|
rtsp->udp_sock.close();
|
||||||
|
rtsp->rtcp_sock.close();
|
||||||
delete rtsp;
|
delete rtsp;
|
||||||
rtsp = NULL;
|
rtsp = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user