This commit is contained in:
Anthony Minessale committed 2011-12-07 11:27:58 -06:00
1 parent fd9158d069
commit f1d5120f63
4 files changed
+25 -6

No files matched your search

+13 -3
View File
@@ -105,7 +105,9 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
void rtmp_handle_invoke(rtmp_session_t *rsession, int amfnumber)
{
rtmp_state_t *state = &rsession->amfstate[amfnumber];
//amf0_data *dump;
#ifdef RTMP_DEBUG_IO
amf0_data *dump;
#endif
int i = 0;
buffer_helper_t helper = { state->buf, 0, state->origlen };
int64_t transaction_id;
@@ -885,10 +887,18 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
uint16_t len = state->origlen;
switch_mutex_lock(rsession->tech_pvt->readbuf_mutex);
if (rsession->tech_pvt->maxlen && switch_buffer_inuse(rsession->tech_pvt->readbuf) > rsession->tech_pvt->maxlen * 3) {
if (rsession->tech_pvt->maxlen && switch_buffer_inuse(rsession->tech_pvt->readbuf) > rsession->tech_pvt->maxlen * 5) {
rsession->tech_pvt->over_size++;
} else {
rsession->tech_pvt->over_size = 0;
}
if (rsession->tech_pvt->over_size > 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"%s buffer > %u for 10 consecutive packets... Flushing buffer\n",
switch_core_session_get_name(rsession->tech_pvt->session), rsession->tech_pvt->maxlen * 5);
switch_buffer_zero(rsession->tech_pvt->readbuf);
#ifdef RTMP_DEBUG_IO
fprintf(rsession->io_debug_in, "[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] FLUSH BUFFER [exceeded %u]\n", rsession->amfnumber, state->type, (int)state->ts, state->stream_id, rsession->tech_pvt->maxlen * 3);
fprintf(rsession->io_debug_in, "[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] FLUSH BUFFER [exceeded %u]\n", rsession->amfnumber, state->type, (int)state->ts, state->stream_id, rsession->tech_pvt->maxlen * 5);
#endif
}
switch_buffer_write(rsession->tech_pvt->readbuf, &len, 2);