Fix #2355: GB28181: Fix play by RTC bug. 4.0.116

pull/2374/head
xialixin 4 years ago committed by winlin
parent 4639510f1b
commit 7d8bde3cdb

@ -176,6 +176,7 @@ The ports used by SRS:
## V4 changes
* 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
* v4.0, 2021-05-15, Rename SrsRtcStream* to SrsRtcSource*. 4.0.113
@ -1923,6 +1924,7 @@ Winlin
[bug #2188]: https://github.com/ossrs/srs/issues/2188
[bug #1193]: https://github.com/ossrs/srs/issues/1193
[bug #2304]: https://github.com/ossrs/srs/issues/2304#issuecomment-826009290
[bug #2355]: https://github.com/ossrs/srs/issues/2355
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[bug #1631]: https://github.com/ossrs/srs/issues/1631

@ -51,6 +51,7 @@ using namespace std;
#include <srs_protocol_utility.hpp>
#include <srs_protocol_format.hpp>
#include <srs_app_sip.hpp>
#include <srs_app_rtc_source.hpp>
//#define W_PS_FILE
//#define W_VIDEO_FILE
@ -1436,10 +1437,38 @@ srs_error_t SrsGb28181RtmpMuxer::initialize(SrsServer *s, SrsRequest* r)
return srs_error_wrap(err, "create source");
}
//TODO: ???
// if (!source->can_publish(false)) {
// return srs_error_new(ERROR_GB28181_SESSION_IS_EXIST, "stream %s busy", req->get_stream_url().c_str());
// }
#ifdef SRS_RTC
SrsRtcSource *rtc = NULL;
bool rtc_server_enabled = _srs_config->get_rtc_server_enabled();
bool rtc_enabled = _srs_config->get_rtc_enabled(req->vhost);
if (rtc_server_enabled && rtc_enabled) {
if ((err = _srs_rtc_sources->fetch_or_create(req, &rtc)) != srs_success) {
return srs_error_wrap(err, "create source");
}
if (!rtc->can_publish()) {
return srs_error_new(ERROR_RTC_SOURCE_BUSY, "gb28181 rtc stream %s busy", req->get_stream_url().c_str());
}
}
#endif
// Check whether RTMP stream is busy.
if (!source->can_publish(false)) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 rtmp: stream %s is busy", req->get_stream_url().c_str());
}
// Bridge to RTC streaming.
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
if (rtc) {
SrsRtcFromRtmpBridger *bridger = new SrsRtcFromRtmpBridger(rtc);
if ((err = bridger->initialize(req)) != srs_success) {
srs_freep(bridger);
return srs_error_wrap(err, "bridger init");
}
source->set_bridger(bridger);
}
#endif
if ((err = source->on_publish()) != srs_success) {
return srs_error_wrap(err, "on publish");

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

Loading…
Cancel
Save