Skip to content

Commit fa379ca

Browse files
committed
Providing extended RTMP timestamps and fixing an RTSP leak occuring on
abrupt disconnections
1 parent 89dc4cf commit fa379ca

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/rtmp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ static int rtmp_send_packet(int message_type, int stream_id, const void *data, i
135135
if (remaining > 0) {
136136
uint8_t h = (3 << 6) | (cs_id & 0x3F);
137137
if (send_data(&h, 1) < 0) return -1;
138+
139+
if (timestamp >= 0xFFFFFF) {
140+
uint8_t ext_ts[4];
141+
ext_ts[0] = (timestamp >> 24) & 0xFF;
142+
ext_ts[1] = (timestamp >> 16) & 0xFF;
143+
ext_ts[2] = (timestamp >> 8) & 0xFF;
144+
ext_ts[3] = timestamp & 0xFF;
145+
if (send_data(ext_ts, 4) < 0) return -1;
146+
}
138147
}
139148
}
140149
return 0;

src/rtsp/rtsp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ static int __message_proc_sock(struct list_t *e, void *p)
398398
ungetc(first_char, con->fp_tcp_read);
399399
} else {
400400
con->con_state = __CON_S_DISCONNECTED;
401+
ASSERT(bufpool_detach(con->pool, con) == SUCCESS, ERR("connection detach failed\n"));
401402
return SUCCESS;
402403
}
403404

@@ -489,6 +490,7 @@ static int __message_proc_sock(struct list_t *e, void *p)
489490
ERR("unexpected empty request, forcing disconnect\n");
490491
con->con_state = __CON_S_DISCONNECTED;
491492
}
493+
ASSERT(bufpool_detach(con->pool, con) == SUCCESS, ERR("connection detach failed\n"));
492494
break;
493495
default: ERR("unexpected method state\n"); return FAILURE;
494496
}

0 commit comments

Comments
 (0)