Commit 67d34195 authored by DanmeiChen's avatar DanmeiChen

set TS_KEEP_ALIVE_INTERVAL to variable

parent ecc63b00
......@@ -29,7 +29,6 @@
#define TS_REDGEN 2
#define TS_NUMBER_OF_OUTBUF TS_REDGEN + 1
#define TS_INBUF_SIZE TS_OUTBUF_SIZE * TS_NUMBER_OF_OUTBUF
#define TS_KEEP_ALIVE_INTERVAL 25000 //10000
#define TS_SEND_INTERVAL 299
#define MS_RTT_4103_SOURCE_SET_T140_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 0, int)
......@@ -37,6 +36,7 @@
#define MS_RTT_4103_SOURCE_SET_RED_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 1, int)
#define MS_RTT_4103_SINK_SET_RED_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SINK_ID, 1, int)
#define MS_RTT_4103_SOURCE_PUT_CHAR32 MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 2, uint32_t)
#define MS_RTT_4103_SOURCE_SET_KEEP_ALIVE_INTERVAL MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 3, unsigned int)
typedef struct _RealtimeTextReceivedCharacter {
uint32_t character;
......
......@@ -29,6 +29,7 @@ typedef struct _RealTimeTextSourceData {
uint32_t timestamp[TS_NUMBER_OF_OUTBUF];
int pt_t140;
int pt_red;
unsigned int keepalive_interval;
} RealTimeTextSourceData;
static uint32_t get_prev_time(const RealTimeTextSourceData *stream) {
......@@ -167,7 +168,7 @@ static mblk_t* send_data(RealTimeTextSourceData *stream, uint32_t timestamp) {
use_next_buf(stream);
}
} else {
if (timestamp < prevtime || (timestamp - prevtime) > TS_KEEP_ALIVE_INTERVAL) {
if (timestamp < prevtime || (timestamp - prevtime) > stream->keepalive_interval) {
ms_rtt_4103_source_putchar32(stream, 0xFEFF); /* BOM */
ms_debug("Sending BOM");
return send_data(stream, timestamp);
......@@ -243,10 +244,22 @@ static int ms_rtt_4103_source_put_char32(MSFilter *f, void *character) {
return 0;
}
static int ms_rtt_4103_source_set_keep_alive_interval(MSFilter *f, void *interval) {
RealTimeTextSourceData *s = (RealTimeTextSourceData *)f->data;
ms_filter_lock(f);
s->keepalive_interval = *(unsigned int *)interval;
ms_debug("Keep alive interval is %i", s->keepalive_interval);
ms_filter_unlock(f);
return 0;
}
static MSFilterMethod ms_rtt_4103_source_methods[] = {
{ MS_RTT_4103_SOURCE_SET_T140_PAYLOAD_TYPE_NUMBER, ms_rtt_4103_source_set_t140_payload },
{ MS_RTT_4103_SOURCE_SET_RED_PAYLOAD_TYPE_NUMBER, ms_rtt_4103_source_set_red_payload },
{ MS_RTT_4103_SOURCE_PUT_CHAR32, ms_rtt_4103_source_put_char32 },
{ MS_RTT_4103_SOURCE_SET_KEEP_ALIVE_INTERVAL, ms_rtt_4103_source_set_keep_alive_interval},
{ 0, NULL }
};
......
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