Commit ed7660f5 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

chromecast: make sure we send all the message data

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 43ef6f5e
...@@ -116,7 +116,7 @@ intf_sys_t::~intf_sys_t() ...@@ -116,7 +116,7 @@ intf_sys_t::~intf_sys_t()
// Use here only C linkage and POD types as this function is a cancelation point. // Use here only C linkage and POD types as this function is a cancelation point.
extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived, extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
uint32_t &i_payloadSize, int i_sock_fd, vlc_tls_t *p_tls, uint32_t &i_payloadSize, int i_sock_fd, vlc_tls_t *p_tls,
unsigned *pi_received, char *p_data, bool *pb_pingTimeout, unsigned *pi_received, uint8_t *p_data, bool *pb_pingTimeout,
int *pi_wait_delay, int *pi_wait_retries) int *pi_wait_delay, int *pi_wait_retries)
{ {
struct pollfd ufd[1]; struct pollfd ufd[1];
...@@ -161,16 +161,15 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived, ...@@ -161,16 +161,15 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
* +------------------------------------+------------------------------+ * +------------------------------------+------------------------------+
* | Payload size (uint32_t big endian) | Payload data | * | Payload size (uint32_t big endian) | Payload data |
* +------------------------------------+------------------------------+ */ * +------------------------------------+------------------------------+ */
if (*pi_received < PACKET_HEADER_LEN) while (*pi_received < PACKET_HEADER_LEN)
{ {
// We receive the header. // We receive the header.
i_ret = tls_Recv(p_tls, p_data, PACKET_HEADER_LEN - *pi_received); i_ret = tls_Recv(p_tls, p_data + *pi_received, PACKET_HEADER_LEN - *pi_received);
if (i_ret <= 0) if (i_ret <= 0)
return i_ret; return i_ret;
*pi_received += i_ret; *pi_received += i_ret;
} }
else
{
// We receive the payload. // We receive the payload.
// Get the size of the payload // Get the size of the payload
...@@ -213,7 +212,7 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived, ...@@ -213,7 +212,7 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
*pi_received = 0; *pi_received = 0;
b_msgReceived = true; b_msgReceived = true;
return i_ret; return i_ret;
}
return i_ret; return i_ret;
} }
...@@ -509,7 +508,7 @@ int intf_sys_t::sendMessages() ...@@ -509,7 +508,7 @@ int intf_sys_t::sendMessages()
void intf_sys_t::handleMessages() void intf_sys_t::handleMessages()
{ {
unsigned i_received = 0; unsigned i_received = 0;
char p_packet[PACKET_MAX_LEN]; uint8_t p_packet[PACKET_MAX_LEN];
bool b_pingTimeout = false; bool b_pingTimeout = false;
int i_waitdelay = PING_WAIT_TIME; int i_waitdelay = PING_WAIT_TIME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment