For #1998, Set default fmtp for H264 when transmux RTMP to RTC

pull/2033/head^2
winlin 4 years ago
parent 9908433bc8
commit 57b5204a10

@ -48,10 +48,12 @@
#include <srs_app_rtc_codec.hpp> #include <srs_app_rtc_codec.hpp>
#endif #endif
// Firefox defaults as 109, Chrome is 111.
const int kAudioPayloadType = 111; const int kAudioPayloadType = 111;
const int kAudioChannel = 2; const int kAudioChannel = 2;
const int kAudioSamplerate = 48000; const int kAudioSamplerate = 48000;
// Firefox defaults as 126, Chrome is 102.
const int kVideoPayloadType = 102; const int kVideoPayloadType = 102;
const int kVideoSamplerate = 90000; const int kVideoSamplerate = 90000;
@ -573,7 +575,7 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source)
// audio track description // audio track description
if (true) { if (true) {
SrsRtcTrackDescription* audio_track_desc = new SrsRtcTrackDescription(); 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->type_ = "audio";
audio_track_desc->id_ = "audio-" + srs_random_str(8); 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->direction_ = "recvonly";
audio_track_desc->media_ = new SrsAudioPayload(kAudioPayloadType, "opus", kAudioSamplerate, kAudioChannel); audio_track_desc->media_ = new SrsAudioPayload(kAudioPayloadType, "opus", kAudioSamplerate, kAudioChannel);
stream_desc->audio_track_desc_ = audio_track_desc->copy();
} }
// video track description // video track description
if (true) { if (true) {
SrsRtcTrackDescription* video_track_desc = new SrsRtcTrackDescription(); 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->type_ = "video";
video_track_desc->id_ = "video-" + srs_random_str(8); 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->ssrc_ = video_ssrc;
video_track_desc->direction_ = "recvonly"; video_track_desc->direction_ = "recvonly";
video_track_desc->media_ = new SrsVideoPayload(kVideoPayloadType, "H264", kVideoSamplerate); SrsVideoPayload* video_payload = new SrsVideoPayload(kVideoPayloadType, "H264", kVideoSamplerate);
stream_desc->video_track_descs_.push_back(video_track_desc->copy()); 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); source_->set_stream_desc(stream_desc);

Loading…
Cancel
Save