From 9c38b42b4c95664603d2eebd0bb1edbc3ba58c01 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 1 Feb 2022 19:14:02 +0100 Subject: [PATCH] fix crash that happened when publishing audio with RTMP (#810) --- internal/core/rtmp_conn.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/core/rtmp_conn.go b/internal/core/rtmp_conn.go index 30bc7a1e..19c284ce 100644 --- a/internal/core/rtmp_conn.go +++ b/internal/core/rtmp_conn.go @@ -254,7 +254,6 @@ func (c *rtmpConn) runRead(ctx context.Context) error { var h264Decoder *rtph264.Decoder var audioTrack *gortsplib.TrackAAC audioTrackID := -1 - var audioClockRate int var aacDecoder *rtpaac.Decoder for i, track := range res.stream.tracks() { @@ -434,7 +433,7 @@ func (c *rtmpConn) runRead(ctx context.Context) error { return err } - pts += 1000 * time.Second / time.Duration(audioClockRate) + pts += 1000 * time.Second / time.Duration(audioTrack.ClockRate()) } } }