SquashSRS4: Refine GB28181

pull/2363/head
xialixin 4 years ago committed by winlin
parent e3bca883e1
commit 2e14d80aa4

@ -182,6 +182,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
@ -1929,6 +1930,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

7
trunk/configure vendored

@ -283,13 +283,10 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
MODULE_FILES+=("srs_app_rtc_codec")
fi
if [[ $SRS_GB28181 == YES ]]; then
MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip")
fi
if [[ $SRS_GB28181 == YES || $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc_jitbuffer")
MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip" "srs_app_gb28181_jitter")
fi
if [[ $SRS_GB28181 == YES ]]; then
MODULE_FILES+=("srs_app_sip")
MODULE_FILES+=("srs_app_gb28181_stack")
ModuleLibIncs+=(${LibIconvRoot})
fi

@ -326,6 +326,23 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root)
dir->name = "http_server";
continue;
}
// SRS4.0, removed the support of configs:
// rtc_server { perf_stat; queue_length; }
if (dir->name == "rtc_server") {
std::vector<SrsConfDirective*>::iterator it;
for (it = dir->directives.begin(); it != dir->directives.end();) {
SrsConfDirective* conf = *it;
if (conf->name == "perf_stat" || conf->name == "queue_length") {
dir->directives.erase(it);
srs_freep(conf);
continue;
}
++it;
}
}
if (!dir->is_vhost()) {
continue;

@ -50,7 +50,8 @@ using namespace std;
#include <srs_app_rtmp_conn.hpp>
#include <srs_protocol_utility.hpp>
#include <srs_protocol_format.hpp>
#include <srs_app_sip.hpp>
#include <srs_app_gb28181_stack.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");

@ -39,7 +39,7 @@
#include <srs_kernel_file.hpp>
#include <srs_protocol_json.hpp>
#include <srs_app_gb28181_sip.hpp>
#include <srs_app_rtc_jitbuffer.hpp>
#include <srs_app_gb28181_jitter.hpp>
#include <srs_rtmp_stack.hpp>
#include <srs_app_source.hpp>
#include <srs_service_conn.hpp>

@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_app_rtc_jitbuffer.hpp>
#include <srs_app_gb28181_jitter.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_kernel_error.hpp>
@ -1201,7 +1201,7 @@ SrsRtpFrameBufferEnum SrsRtpJitterBuffer::InsertPacket(uint16_t seq, uint32_t ts
//CountFrame(*frame);
// if (previous_state != kStateDecodable &&
// previous_state != kStateComplete) {
// /*CountFrame(*frame);*/ //????????????????????<3F>?? by ylr
// /*CountFrame(*frame);
// if (continuous) {
// // Signal that we have a complete session.
// frame_event_->Set();
@ -1213,7 +1213,7 @@ SrsRtpFrameBufferEnum SrsRtpJitterBuffer::InsertPacket(uint16_t seq, uint32_t ts
case kDecodableSession: {
// *retransmitted = (frame->GetNackCount() > 0);
if (true || continuous) {
if (continuous) {
decodable_frames_.InsertFrame(frame);
FindAndInsertContinuousFrames(*frame);
} else {
@ -1522,7 +1522,9 @@ bool SrsRtpJitterBuffer::NextMaybeIncompleteTimestamp(uint32_t* timestamp)
SrsRtpFrameBuffer* oldest_frame;
if (decodable_frames_.empty()) {
if (incomplete_frames_.size() <= 1) {
//in order to solve the problem of bad network, we can wait for more incomplete frames
//ex fps=15
if (incomplete_frames_.size() < 15) {
return false;
}

@ -21,8 +21,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_APP_RTC_RTP_JITBUFFER_HPP
#define SRS_APP_RTC_RTP_JITBUFFER_HPP
#ifndef SRS_APP_GB28181_RTP_JITBUFFER_HPP
#define SRS_APP_GB28181_RTP_JITBUFFER_HPP
#include <srs_core.hpp>

@ -43,7 +43,7 @@ using namespace std;
#include <srs_kernel_utility.hpp>
#include <srs_kernel_codec.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_app_sip.hpp>
#include <srs_app_gb28181_stack.hpp>
#include <srs_app_gb28181.hpp>

@ -31,7 +31,7 @@
#include <map>
#include <srs_app_log.hpp>
#include <srs_app_sip.hpp>
#include <srs_app_gb28181_stack.hpp>
#include <srs_app_gb28181.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_service_conn.hpp>

@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_app_sip.hpp>
#include <srs_app_gb28181_stack.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)

@ -21,8 +21,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_PROTOCOL_SIP_HPP
#define SRS_PROTOCOL_SIP_HPP
#ifndef SRS_APP_GB28181_STACK_HPP
#define SRS_APP_GB28181_STACK_HPP
#include <srs_core.hpp>

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

Loading…
Cancel
Save