From 22e5c8627b9bef85ffd052e8008c120139e87257 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Thu, 3 Nov 2022 22:54:06 +0300 Subject: [PATCH] removed sps/pps from sdp --- janus/src/plugin.c | 4 ---- janus/src/rtpv.c | 44 +++------------------------------------ janus/src/rtpv.h | 7 ------- janus/src/uslibs/base64.c | 1 - janus/src/uslibs/base64.h | 1 - 5 files changed, 3 insertions(+), 54 deletions(-) delete mode 120000 janus/src/uslibs/base64.c delete mode 120000 janus/src/uslibs/base64.h diff --git a/janus/src/plugin.c b/janus/src/plugin.c index 89840b2..e2b2e99 100644 --- a/janus/src/plugin.c +++ b/janus/src/plugin.c @@ -429,10 +429,6 @@ static struct janus_plugin_result *_plugin_handle_message( { // atomic_store(&_g_key_required, true); char *const video_sdp = us_rtpv_make_sdp(_g_rtpv); - if (video_sdp == NULL) { - PUSH_ERROR(503, "Haven't received SPS/PPS from memsink yet"); - goto ok_wait; - } char *const audio_sdp = (_g_rtpa ? us_rtpa_make_sdp(_g_rtpa) : us_strdup("")); US_ASPRINTF(sdp, "v=0" RN diff --git a/janus/src/rtpv.c b/janus/src/rtpv.c index de02961..e81b93f 100644 --- a/janus/src/rtpv.c +++ b/janus/src/rtpv.c @@ -36,35 +36,15 @@ us_rtpv_s *us_rtpv_init(us_rtp_callback_f callback, bool zero_playout_delay) { US_CALLOC(rtpv, 1); rtpv->rtp = us_rtp_init(96, true, zero_playout_delay); rtpv->callback = callback; - rtpv->sps = us_frame_init(); - rtpv->pps = us_frame_init(); - US_MUTEX_INIT(rtpv->mutex); return rtpv; } void us_rtpv_destroy(us_rtpv_s *rtpv) { - US_MUTEX_DESTROY(rtpv->mutex); - us_frame_destroy(rtpv->pps); - us_frame_destroy(rtpv->sps); us_rtp_destroy(rtpv->rtp); free(rtpv); } char *us_rtpv_make_sdp(us_rtpv_s *rtpv) { - US_MUTEX_LOCK(rtpv->mutex); - - if (rtpv->sps->used == 0 || rtpv->pps->used == 0) { - US_MUTEX_UNLOCK(rtpv->mutex); - return NULL; - } - - char *sps = NULL; - char *pps = NULL; - us_base64_encode(rtpv->sps->data, rtpv->sps->used, &sps, NULL); - us_base64_encode(rtpv->pps->data, rtpv->pps->used, &pps, NULL); - - US_MUTEX_UNLOCK(rtpv->mutex); - # define PAYLOAD rtpv->rtp->payload // https://tools.ietf.org/html/rfc6184 // https://github.com/meetecho/janus-gateway/issues/2443 @@ -75,8 +55,6 @@ char *us_rtpv_make_sdp(us_rtpv_s *rtpv) { "a=rtpmap:%u H264/90000" RN "a=fmtp:%u profile-level-id=42E01F" RN "a=fmtp:%u packetization-mode=1" RN - "a=fmtp:%u sprop-sps=%s" RN - "a=fmtp:%u sprop-pps=%s" RN "a=rtcp-fb:%u nack" RN "a=rtcp-fb:%u nack pli" RN "a=rtcp-fb:%u goog-remb" RN @@ -84,17 +62,12 @@ char *us_rtpv_make_sdp(us_rtpv_s *rtpv) { "%s" // playout-delay "a=sendonly" RN, PAYLOAD, PAYLOAD, PAYLOAD, PAYLOAD, - PAYLOAD, sps, - PAYLOAD, pps, PAYLOAD, PAYLOAD, PAYLOAD, rtpv->rtp->ssrc, (rtpv->rtp->zero_playout_delay ? "a=extmap:1 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay" RN : "") ); -# undef PAYLOAD - - free(sps); - free(pps); return sdp; +# undef PAYLOAD } #define _PRE 3 // Annex B prefix length @@ -136,22 +109,11 @@ void us_rtpv_wrap(us_rtpv_s *rtpv, const us_frame_s *frame) { } void _rtpv_process_nalu(us_rtpv_s *rtpv, const uint8_t *data, size_t size, uint32_t pts, bool marked) { +# define DG rtpv->rtp->datagram + const unsigned ref_idc = (data[0] >> 5) & 3; const unsigned type = data[0] & 0x1F; - us_frame_s *ps = NULL; - switch (type) { - case 7: ps = rtpv->sps; break; - case 8: ps = rtpv->pps; break; - } - if (ps != NULL) { - US_MUTEX_LOCK(rtpv->mutex); - us_frame_set_data(ps, data, size); - US_MUTEX_UNLOCK(rtpv->mutex); - } - -# define DG rtpv->rtp->datagram - if (size + US_RTP_HEADER_SIZE <= US_RTP_DATAGRAM_SIZE) { us_rtp_write_header(rtpv->rtp, pts, marked); memcpy(DG + US_RTP_HEADER_SIZE, data, size); diff --git a/janus/src/rtpv.h b/janus/src/rtpv.h index 81fc142..e24736d 100644 --- a/janus/src/rtpv.h +++ b/janus/src/rtpv.h @@ -31,12 +31,8 @@ #include #include -#include - #include "uslibs/tools.h" -#include "uslibs/threading.h" #include "uslibs/frame.h" -#include "uslibs/base64.h" #include "rtp.h" @@ -44,9 +40,6 @@ typedef struct { us_rtp_s *rtp; us_rtp_callback_f callback; - us_frame_s *sps; // Actually not a frame, just a bytes storage - us_frame_s *pps; - pthread_mutex_t mutex; } us_rtpv_s; diff --git a/janus/src/uslibs/base64.c b/janus/src/uslibs/base64.c deleted file mode 120000 index e23719d..0000000 --- a/janus/src/uslibs/base64.c +++ /dev/null @@ -1 +0,0 @@ -../../../src/libs/base64.c \ No newline at end of file diff --git a/janus/src/uslibs/base64.h b/janus/src/uslibs/base64.h deleted file mode 120000 index 72182d3..0000000 --- a/janus/src/uslibs/base64.h +++ /dev/null @@ -1 +0,0 @@ -../../../src/libs/base64.h \ No newline at end of file