Skip to content

Commit

Permalink
For #1998, Set default fmtp for H264 when transmux RTMP to RTC
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 12, 2020
1 parent 9908433 commit 57b5204
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@
#include <srs_app_rtc_codec.hpp>
#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;

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 57b5204

Please sign in to comment.