sniffing glue
This commit is contained in:
parent
7656a075c7
commit
5cb635039d
|
@ -1159,6 +1159,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
|
case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
|
||||||
{
|
{
|
||||||
|
switch_time_t now = switch_micro_time_now();
|
||||||
|
switch_time_t diff;
|
||||||
|
|
||||||
rh->rready = 1;
|
rh->rready = 1;
|
||||||
|
|
||||||
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
||||||
|
@ -1170,9 +1173,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
|
|
||||||
switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
|
switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
|
||||||
switch_core_file_write(&rh->out_fh, fill_data, &fill_len);
|
switch_core_file_write(&rh->out_fh, fill_data, &fill_len);
|
||||||
} else {
|
}
|
||||||
switch_time_t now = switch_micro_time_now();
|
|
||||||
switch_time_t diff;
|
|
||||||
|
|
||||||
if (rh->last_read_time && rh->last_read_time < now) {
|
if (rh->last_read_time && rh->last_read_time < now) {
|
||||||
diff = ((now - rh->last_read_time) + 3000 ) / rh->read_impl.microseconds_per_packet;
|
diff = ((now - rh->last_read_time) + 3000 ) / rh->read_impl.microseconds_per_packet;
|
||||||
|
@ -1188,7 +1190,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_file_write(&rh->in_fh, mask ? null_data : nframe->data, &len);
|
switch_core_file_write(&rh->in_fh, mask ? null_data : nframe->data, &len);
|
||||||
rh->last_read_time = now;
|
rh->last_read_time = now;
|
||||||
|
@ -1197,6 +1198,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
|
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
|
||||||
{
|
{
|
||||||
|
switch_time_t now = switch_micro_time_now();
|
||||||
|
switch_time_t diff;
|
||||||
rh->wready = 1;
|
rh->wready = 1;
|
||||||
|
|
||||||
if (!rh->rready) {
|
if (!rh->rready) {
|
||||||
|
@ -1204,9 +1207,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
switch_size_t fill_len = len;
|
switch_size_t fill_len = len;
|
||||||
switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
|
switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
|
||||||
switch_core_file_write(&rh->in_fh, fill_data, &fill_len);
|
switch_core_file_write(&rh->in_fh, fill_data, &fill_len);
|
||||||
} else {
|
}
|
||||||
switch_time_t now = switch_micro_time_now();
|
|
||||||
switch_time_t diff;
|
|
||||||
|
|
||||||
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
||||||
len = nframe->datalen;
|
len = nframe->datalen;
|
||||||
|
@ -1226,7 +1228,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_file_write(&rh->out_fh, mask ? null_data : nframe->data, &len);
|
switch_core_file_write(&rh->out_fh, mask ? null_data : nframe->data, &len);
|
||||||
rh->last_write_time = now;
|
rh->last_write_time = now;
|
||||||
|
|
Loading…
Reference in New Issue