From 57b5204a101b5efeea24e2a976933d1f538654b5 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 12 Nov 2020 18:36:50 +0800 Subject: [PATCH] For #1998, Set default fmtp for H264 when transmux RTMP to RTC --- trunk/src/app/srs_app_rtc_source.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index bc7c8b93e9..65a10b26f7 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -48,10 +48,12 @@ #include #endif +// Firefox defaults as 109, Chrome is 111. const int kAudioPayloadType = 111; const int kAudioChannel = 2; const int kAudioSamplerate = 48000; +// Firefox defaults as 126, Chrome is 102. const int kVideoPayloadType = 102; const int kVideoSamplerate = 90000; @@ -573,7 +575,7 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source) // audio track description if (true) { SrsRtcTrackDescription* audio_track_desc = new SrsRtcTrackDescription(); - SrsAutoFree(SrsRtcTrackDescription, audio_track_desc); + stream_desc->audio_track_desc_ = audio_track_desc; audio_track_desc->type_ = "audio"; audio_track_desc->id_ = "audio-" + srs_random_str(8); @@ -583,13 +585,12 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source) audio_track_desc->direction_ = "recvonly"; audio_track_desc->media_ = new SrsAudioPayload(kAudioPayloadType, "opus", kAudioSamplerate, kAudioChannel); - stream_desc->audio_track_desc_ = audio_track_desc->copy(); } // video track description if (true) { SrsRtcTrackDescription* video_track_desc = new SrsRtcTrackDescription(); - SrsAutoFree(SrsRtcTrackDescription, video_track_desc); + stream_desc->video_track_descs_.push_back(video_track_desc); video_track_desc->type_ = "video"; video_track_desc->id_ = "video-" + srs_random_str(8); @@ -598,8 +599,10 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source) video_track_desc->ssrc_ = video_ssrc; video_track_desc->direction_ = "recvonly"; - video_track_desc->media_ = new SrsVideoPayload(kVideoPayloadType, "H264", kVideoSamplerate); - stream_desc->video_track_descs_.push_back(video_track_desc->copy()); + SrsVideoPayload* video_payload = new SrsVideoPayload(kVideoPayloadType, "H264", kVideoSamplerate); + video_track_desc->media_ = video_payload; + + video_payload->set_h264_param_desc("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"); } source_->set_stream_desc(stream_desc);