Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ed7660f5
Commit
ed7660f5
authored
Dec 23, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Dec 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chromecast: make sure we send all the message data
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
43ef6f5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
35 deletions
+34
-35
modules/stream_out/chromecast/chromecast_ctrl.cpp
modules/stream_out/chromecast/chromecast_ctrl.cpp
+34
-35
No files found.
modules/stream_out/chromecast/chromecast_ctrl.cpp
View file @
ed7660f5
...
...
@@ -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.
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
,
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
)
{
struct
pollfd
ufd
[
1
];
...
...
@@ -161,47 +161,32 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
* +------------------------------------+------------------------------+
* | Payload size (uint32_t big endian) | Payload data |
* +------------------------------------+------------------------------+ */
if
(
*
pi_received
<
PACKET_HEADER_LEN
)
while
(
*
pi_received
<
PACKET_HEADER_LEN
)
{
// 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
)
return
i_ret
;
*
pi_received
+=
i_ret
;
}
else
{
// We receive the payload.
// Get the size of the payload
memcpy
(
&
i_payloadSize
,
p_data
,
PACKET_HEADER_LEN
);
i_payloadSize
=
hton32
(
i_payloadSize
);
const
uint32_t
i_maxPayloadSize
=
PACKET_MAX_LEN
-
PACKET_HEADER_LEN
;
if
(
i_payloadSize
>
i_maxPayloadSize
)
{
// Error case: the packet sent by the Chromecast is too long: we drop it.
msg_Err
(
p_stream
,
"Packet too long: droping its data"
);
uint32_t
i_size
=
i_payloadSize
-
(
*
pi_received
-
PACKET_HEADER_LEN
);
if
(
i_size
>
i_maxPayloadSize
)
i_size
=
i_maxPayloadSize
;
// We receive the payload.
i_ret
=
tls_Recv
(
p_tls
,
p_data
+
PACKET_HEADER_LEN
,
i_size
);
if
(
i_ret
<=
0
)
return
i_ret
;
*
pi_received
+=
i_ret
;
// Get the size of the payload
memcpy
(
&
i_payloadSize
,
p_data
,
PACKET_HEADER_LEN
);
i_payloadSize
=
hton32
(
i_payloadSize
)
;
const
uint32_t
i_maxPayloadSize
=
PACKET_MAX_LEN
-
PACKET_HEADER_LEN
;
if
(
*
pi_received
<
i_payloadSize
+
PACKET_HEADER_LEN
)
return
i_ret
;
if
(
i_payloadSize
>
i_maxPayloadSize
)
{
// Error case: the packet sent by the Chromecast is too long: we drop it.
msg_Err
(
p_stream
,
"Packet too long: droping its data"
);
*
pi_received
=
0
;
return
-
1
;
}
uint32_t
i_size
=
i_payloadSize
-
(
*
pi_received
-
PACKET_HEADER_LEN
)
;
if
(
i_size
>
i_maxPayloadSize
)
i_size
=
i_maxPayloadSize
;
// Normal case
i_ret
=
tls_Recv
(
p_tls
,
p_data
+
*
pi_received
,
i_payloadSize
-
(
*
pi_received
-
PACKET_HEADER_LEN
));
i_ret
=
tls_Recv
(
p_tls
,
p_data
+
PACKET_HEADER_LEN
,
i_size
);
if
(
i_ret
<=
0
)
return
i_ret
;
*
pi_received
+=
i_ret
;
...
...
@@ -209,12 +194,26 @@ extern "C" int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
if
(
*
pi_received
<
i_payloadSize
+
PACKET_HEADER_LEN
)
return
i_ret
;
assert
(
*
pi_received
==
i_payloadSize
+
PACKET_HEADER_LEN
);
*
pi_received
=
0
;
b_msgReceived
=
true
;
return
i_ret
;
return
-
1
;
}
// Normal case
i_ret
=
tls_Recv
(
p_tls
,
p_data
+
*
pi_received
,
i_payloadSize
-
(
*
pi_received
-
PACKET_HEADER_LEN
));
if
(
i_ret
<=
0
)
return
i_ret
;
*
pi_received
+=
i_ret
;
if
(
*
pi_received
<
i_payloadSize
+
PACKET_HEADER_LEN
)
return
i_ret
;
assert
(
*
pi_received
==
i_payloadSize
+
PACKET_HEADER_LEN
);
*
pi_received
=
0
;
b_msgReceived
=
true
;
return
i_ret
;
return
i_ret
;
}
...
...
@@ -509,7 +508,7 @@ int intf_sys_t::sendMessages()
void
intf_sys_t
::
handleMessages
()
{
unsigned
i_received
=
0
;
char
p_packet
[
PACKET_MAX_LEN
];
uint8_t
p_packet
[
PACKET_MAX_LEN
];
bool
b_pingTimeout
=
false
;
int
i_waitdelay
=
PING_WAIT_TIME
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment