Merge branch '4.0release' into merge/develop

pull/2943/head
winlin 4 years ago
commit 5251ac9cca

@ -183,6 +183,7 @@ The ports used by SRS:
## V4 changes
* v4.0, 2021-05-19, Fix [#2362][bug #2362]: Allow WebRTC to play before publishing, for GB28181 as such. 4.0.117
* v4.0, 2021-05-18, Fix [#2355][bug #2355]: GB28181: Fix play by RTC bug. 4.0.116
* v4.0, 2021-05-15, SRT: Build SRT from source by SRS. 4.0.115
* v4.0, 2021-05-15, Rename SrsConsumer* to SrsLiveConsumer*. 4.0.114
@ -1933,6 +1934,7 @@ Winlin
[bug #2304]: https://github.com/ossrs/srs/issues/2304#issuecomment-826009290
[bug #2355]: https://github.com/ossrs/srs/issues/2355
[bug #307]: https://github.com/ossrs/srs/issues/307
[bug #2362]: https://github.com/ossrs/srs/issues/2362
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[bug #1631]: https://github.com/ossrs/srs/issues/1631

@ -11,8 +11,8 @@
点击进入<a id="cn" href="#">SRS控制台</a>
</p>
<p>
Click <a href="players/">here</a> to start SRS player.<br/>
点击进入<a href="players/">SRS播放器</a>
Click <a href="players/?autostart=true">here</a> to start SRS player.<br/>
点击进入<a href="players/?autostart=true">SRS播放器</a>
</p>
<p><a href="https://github.com/ossrs/srs">SRS Team &copy; 2021</a></p>
<script type="text/javascript">

@ -367,9 +367,60 @@ srs_error_t SrsRtcSource::initialize(SrsRequest* r)
req = r->copy();
// Create default relations to allow play before publishing.
// @see https://github.com/ossrs/srs/issues/2362
init_for_play_before_publishing();
return err;
}
void SrsRtcSource::init_for_play_before_publishing()
{
// If the stream description has already been setup by RTC publisher,
// we should ignore and it's ok, because we only need to setup it for bridger.
if (stream_desc_) {
return;
}
SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription();
SrsAutoFree(SrsRtcSourceDescription, stream_desc);
// audio track description
if (true) {
SrsRtcTrackDescription* audio_track_desc = new SrsRtcTrackDescription();
stream_desc->audio_track_desc_ = audio_track_desc;
audio_track_desc->type_ = "audio";
audio_track_desc->id_ = "audio-" + srs_random_str(8);
uint32_t audio_ssrc = SrsRtcSSRCGenerator::instance()->generate_ssrc();
audio_track_desc->ssrc_ = audio_ssrc;
audio_track_desc->direction_ = "recvonly";
audio_track_desc->media_ = new SrsAudioPayload(kAudioPayloadType, "opus", kAudioSamplerate, kAudioChannel);
}
// video track description
if (true) {
SrsRtcTrackDescription* video_track_desc = new SrsRtcTrackDescription();
stream_desc->video_track_descs_.push_back(video_track_desc);
video_track_desc->type_ = "video";
video_track_desc->id_ = "video-" + srs_random_str(8);
uint32_t video_ssrc = SrsRtcSSRCGenerator::instance()->generate_ssrc();
video_track_desc->ssrc_ = video_ssrc;
video_track_desc->direction_ = "recvonly";
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");
}
set_stream_desc(stream_desc);
}
void SrsRtcSource::update_auth(SrsRequest* r)
{
req->update_auth(r);
@ -542,9 +593,6 @@ void SrsRtcSource::on_unpublish()
srs_freep(bridger_);
}
// release unpublish stream description.
set_stream_desc(NULL);
// TODO: FIXME: Handle by statistic.
}
@ -675,46 +723,20 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
audio_sequence = 0;
video_sequence = 0;
SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription();
SrsAutoFree(SrsRtcSourceDescription, stream_desc);
// audio track description
// audio track ssrc
if (true) {
SrsRtcTrackDescription* audio_track_desc = new SrsRtcTrackDescription();
stream_desc->audio_track_desc_ = audio_track_desc;
audio_track_desc->type_ = "audio";
audio_track_desc->id_ = "audio-" + srs_random_str(8);
audio_ssrc = SrsRtcSSRCGenerator::instance()->generate_ssrc();
audio_track_desc->ssrc_ = audio_ssrc;
audio_track_desc->direction_ = "recvonly";
audio_track_desc->media_ = new SrsAudioPayload(kAudioPayloadType, "opus", kAudioSamplerate, kAudioChannel);
std::vector<SrsRtcTrackDescription*> descs = source->get_track_desc("audio", "opus");
if (!descs.empty()) {
audio_ssrc = descs.at(0)->ssrc_;
}
}
// video track description
// video track ssrc
if (true) {
SrsRtcTrackDescription* video_track_desc = new SrsRtcTrackDescription();
stream_desc->video_track_descs_.push_back(video_track_desc);
video_track_desc->type_ = "video";
video_track_desc->id_ = "video-" + srs_random_str(8);
video_ssrc = SrsRtcSSRCGenerator::instance()->generate_ssrc();
video_track_desc->ssrc_ = video_ssrc;
video_track_desc->direction_ = "recvonly";
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");
std::vector<SrsRtcTrackDescription*> descs = source->get_track_desc("video", "H264");
if (!descs.empty()) {
video_ssrc = descs.at(0)->ssrc_;
}
// If the stream description has already been setup by RTC publisher,
// we should ignore and it's ok, because we only need to setup it for bridger.
if (!source_->has_stream_desc()) {
source_->set_stream_desc(stream_desc);
}
}

@ -209,6 +209,9 @@ public:
virtual ~SrsRtcSource();
public:
virtual srs_error_t initialize(SrsRequest* r);
private:
void init_for_play_before_publishing();
public:
// Update the authentication information in request.
virtual void update_auth(SrsRequest* r);
private:

@ -961,6 +961,15 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
SrsRequest* req = info->req;
// @see https://github.com/ossrs/srs/issues/2364
// Check whether GB28181 stream is busy.
#if defined(SRS_GB28181)
SrsGb28181RtmpMuxer* gb28181 = _srs_gb28181->fetch_rtmpmuxer(req->stream);
if (gb28181 != NULL) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 stream %s busy", req->get_stream_url().c_str());
}
#endif
// Check whether RTC stream is busy.
#ifdef SRS_RTC
SrsRtcSource *rtc = NULL;

@ -26,6 +26,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 116
#define VERSION_REVISION 117
#endif

Loading…
Cancel
Save