aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rtsp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/rtsp.c b/lib/rtsp.c
index 873b15f5f..efbdf5d7a 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -54,6 +54,11 @@
*/
+#define RTP_PKT_CHANNEL(p) ((int)((unsigned char)((p)[1])))
+
+#define RTP_PKT_LENGTH(p) ((((int)((unsigned char)((p)[2]))) << 8) | \
+ ((int)((unsigned char)((p)[3]))))
+
static int rtsp_getsock_do(struct connectdata *conn,
curl_socket_t *socks,
int numsocks);
@@ -544,16 +549,14 @@ CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data,
while((rtp_dataleft > 0) &&
(rtp[0] == '$')) {
if(rtp_dataleft > 4) {
- char channel;
int rtp_length;
/* Parse the header */
/* The channel identifier immediately follows and is 1 byte */
- channel = rtp[1];
- rtspc->rtp_channel = (int) channel;
+ rtspc->rtp_channel = RTP_PKT_CHANNEL(rtp);
/* The length is two bytes */
- rtp_length = ntohs( *((unsigned short *)(&rtp[2])) );
+ rtp_length = RTP_PKT_LENGTH(rtp);
if(rtp_dataleft < rtp_length + 4) {
/* Need more - incomplete payload*/