Browse Source

TT#99503 fix possible T.38 gateway deadlock

closes #1100

Change-Id: Ifd4be1ca5d4f343a805be31d39abdb73011ec6c4
(cherry picked from commit 0c581e59a1)
mr8.5.3
Richard Fuchs 5 years ago
parent
commit
eb3104e6bd
2 changed files with 17 additions and 3 deletions
  1. +8
    -3
      daemon/t38.c
  2. +9
    -0
      include/media_player.h

+ 8
- 3
daemon/t38.c View File

@ -283,12 +283,17 @@ static void t38_pcm_player(struct media_player *mp) {
ilog(LOG_DEBUG, "Generated %i T.38 PCM samples", num); 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; tg->pts += num;
mutex_unlock(&tg->lock); 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);
} }


+ 9
- 0
include/media_player.h View File

@ -60,11 +60,20 @@ INLINE void media_player_put(struct media_player **mp) {
obj_put(&(*mp)->tt_obj); obj_put(&(*mp)->tt_obj);
*mp = NULL; *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 #else
INLINE void media_player_put(struct media_player **mp) { INLINE void media_player_put(struct media_player **mp) {
} }
INLINE struct media_player *media_player_get(struct media_player *mp) {
return NULL;
}
#endif #endif


Loading…
Cancel
Save