TT#99503 fix possible T.38 gateway deadlock

closes #1100

Change-Id: Ifd4be1ca5d4f343a805be31d39abdb73011ec6c4
(cherry picked from commit 0c581e59a1)
pull/1116/head
Richard Fuchs 5 years ago
parent f0212124fe
commit 64ba12c4c7

@ -284,12 +284,17 @@ static void t38_pcm_player(struct media_player *mp) {
ilog(LOG_DEBUG, "Generated %i T.38 PCM samples", num);
// this reschedules our player as well
media_player_add_packet(tg->pcm_player, (char *) smp, num * 2, num * 1000000 / 8000, tg->pts);
// release gateway lock as the media player may trigger a lock on the SSRC objects
// and this is the wrong lock order
struct media_player *pcm_player = media_player_get(tg->pcm_player);
unsigned long long pts = tg->pts;
tg->pts += num;
mutex_unlock(&tg->lock);
// this reschedules our player as well
media_player_add_packet(pcm_player, (char *) smp, num * 2, num * 1000000 / 8000, pts);
media_player_put(&pcm_player);
}

@ -60,11 +60,20 @@ INLINE void media_player_put(struct media_player **mp) {
obj_put(&(*mp)->tt_obj);
*mp = NULL;
}
INLINE struct media_player *media_player_get(struct media_player *mp) {
if (!mp)
return NULL;
obj_hold(&mp->tt_obj);
return mp;
}
#else
INLINE void media_player_put(struct media_player **mp) {
}
INLINE struct media_player *media_player_get(struct media_player *mp) {
return NULL;
}
#endif

Loading…
Cancel
Save