MT#56861 support DTMF injection with kernel mode

Add a flag to inhibit kernel mode while DTMF injection is active. Tie in
DTMF playback trigger function: Remove stream from kernel, set inhibit
flag, play DTMF, then unset inhibit flag when all events have been
injected.

Change-Id: I533ec95a676bc7edf4dd973217f8d9499f1e22b6
pull/1657/head
Richard Fuchs 3 years ago
parent 8fc168784f
commit 8cb7a4c9a6

@ -3262,6 +3262,9 @@ const char *call_play_dtmf_ng(bencode_item_t *input, bencode_item_t *output) {
// XXX fall back to generating a secondary stream
found:
monologue->dtmf_injection_active = 1;
dialogue_unkernelize(monologue, "DTMF playback");
for (GList *k = monologue->subscribers.head; k; k = k->next) {
struct call_subscription *cs = k->data;
struct call_monologue *dialogue = cs->monologue;

@ -1665,6 +1665,8 @@ static int handler_func_passthrough(struct codec_handler *h, struct media_packet
codec_calc_lost(mp->ssrc_in, ntohs(mp->rtp->seq_num));
}
mp->media->monologue->dtmf_injection_active = 0;
__buffer_delay_raw(h->delay_buffer, h, codec_add_raw_packet, mp, h->source_pt.clock_rate);
return 0;
@ -2435,6 +2437,9 @@ static int handler_func_passthrough_ssrc(struct codec_handler *h, struct media_p
add_packet_fn = codec_add_raw_packet_dup;
}
else if (!ch->dtmf_events.length)
mp->media->monologue->dtmf_injection_active = 0;
obj_put(&ch->h);
}

@ -2479,6 +2479,9 @@ static void media_packet_kernel_check(struct packet_handler_ctx *phc) {
return;
}
if (phc->mp.media->monologue->dtmf_injection_active)
return;
mutex_lock(&phc->mp.stream->in_lock);
kernelize(phc->mp.stream);
mutex_unlock(&phc->mp.stream->in_lock);

@ -538,6 +538,7 @@ struct call_monologue {
unsigned int rec_forwarding:1;
unsigned int inject_dtmf:1;
unsigned int dtmf_injection_active:1;
unsigned int detect_dtmf:1;
};

Loading…
Cancel
Save