Skip to content

srs-4.0.95 GB28181 RTC cannot play #2355

Closed
@wtjzw

Description

@wtjzw

Description'

Please ensure that the markdown structure is maintained.

srs gb28181 cannot play in srs_gb28181.html. It works fine in version 4.0.91, but starting from version 4.0.107, both FLV and RTC playback are experiencing errors.

  1. SRS version: 4.0.95
  2. The log for SRS is as follows:
[2021-05-17 10:39:52.277][Warn][26661][mht88191][11] RTC error code=5018 : create session, dtls=1, srtp=1, eip= : create session : add player : no play relations
thread [26661][mht88191]: do_serve_http() [src/app/srs_app_rtc_api.cpp:204][errno=11]
thread [26661][mht88191]: create_session() [src/app/srs_app_rtc_server.cpp:485][errno=11]
thread [26661][mht88191]: do_create_session() [src/app/srs_app_rtc_server.cpp:506][errno=11]
thread [26661][mht88191]: add_player() [src/app/srs_app_rtc_conn.cpp:1905][errno=11]

srs_error_t SrsRtcConnection::add_player(SrsRtcUserConfig* ruc, SrsSdp& local_sdp)
{
    srs_error_t err = srs_success;

    SrsRequest* req = ruc->req_;

    if (_srs_rtc_hijacker) {
        if ((err = _srs_rtc_hijacker->on_before_play(this, req)) != srs_success) {
            return srs_error_wrap(err, "before play");
        }
    }

    std::map<uint32_t, SrsRtcTrackDescription*> play_sub_relations;
    if ((err = negotiate_play_capability(ruc, play_sub_relations)) != srs_success) {
        return srs_error_wrap(err, "play negotiate");
    }

If the number of play sub relations is zero, an error occurred at this point.
        return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no play relations");
    }

    SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription();
    SrsAutoFree(SrsRtcStreamDescription, stream_desc);
    std::map<uint32_t, SrsRtcTrackDescription*>::iterator it = play_sub_relations.begin();
    while (it != play_sub_relations.end()) {
        SrsRtcTrackDescription* track_desc = it->second;

        // TODO: FIXME: we only support one audio track.
        if (track_desc->type_ == "audio" && !stream_desc->audio_track_desc_) {
            stream_desc->audio_track_desc_ = track_desc->copy();
        }

        if (track_desc->type_ == "video") {
            stream_desc->video_track_descs_.push_back(track_desc->copy());
        }
        ++it;
    }

    if ((err = generate_play_local_sdp(req, local_sdp, stream_desc, ruc->remote_sdp_.is_unified())) != srs_success) {
        return srs_error_wrap(err, "generate local sdp");
    }

    if ((err = create_player(req, play_sub_relations)) != srs_success) {
        return srs_error_wrap(err, "create player");
    }

    return err;
}
  1. The configuration of SRS is as follows (Config):
# push gb28181 stream to SRS.

listen                  1935;
max_connections         1000;
daemon                  off;
srs_log_tank            console;
srs_log_level           trace;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api {
    enabled         on;
    listen          1985;
}
stats {
    network         0;
}
rtc_server {
    enabled         on;
    # Listen at udp://8000
    listen          8000;
    #
    # The $CANDIDATE means fetch from env, if not configed, use * as default.
    #
    # The * means retrieving server IP automatically, from all network interfaces,
    # @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
    candidate      10.2.237.42;
}

stream_caster {
    enabled             on;
    caster              gb28181;

    # Forward the stream to the rtmp server address and port
    # TODO: https://github.com/ossrs/srs/pull/1679/files#r400875104
    # [stream] is the VideoChannelCodecID for sip
    # The automatically created channel [stream] is 'chid[ssrc]' where [ssrc] is the rtp ssrc
    # [ssrc] is the ssrc in rtp
    output              rtmp://127.0.0.1:1935/live/[stream];
    
    # Multiplexing port for receiving rtp streams from the device end
    listen              9000;
    # Multiplexing port type, on for TCP, off for UDP
    # Default: off
    # tcp_enable            off;

    # Range of RTP receiving listening ports, minimum value
    rtp_port_min        58200;
    # Range of RTP receiving listening ports, maximum value
    rtp_port_max        58300;

    # Whether to wait for a keyframe before forwarding,
    # off: No need to wait, forward directly
    # on: Wait for the first keyframe before forwarding
    wait_keyframe       off;
    
    # Idle waiting time for RTP packets, if no packets are received within the specified time
    # the RTP listening connection will automatically stop and send a BYE command.
    rtp_idle_timeout    30;

    # Whether to forward the audio stream
    # Currently only supports AAC format, so the device needs to support AAC format
    # on: forward audio
    # off: do not forward audio, only video
    # *Note*!!!: flv only supports three formats: 11025, 22050, 44100
    # If the device does not support any of these three formats, it will automatically select one format during forwarding
    # At the same time, the ADTS header will be encapsulated in the flv AAC raw data
    # This allows the player to automatically select the sampling frequency based on the ADTS header
    # Players like ffplay and vlc can do this, but flash does not have sound
    # because flash only supports 11025, 22050, 44100.
    audio_enable        off;

    # Whether to enable RTP buffering
    # Enabling it can effectively solve issues such as RTP disorder.
    # jitterbuffer_enable  on;

    # Server host number, can be a domain name or IP address
    # This is the address to which the device sends media. If the server is on an internal or external network,
    # the external address needs to be specified.
    # When calling the API to create a stream session, the returned IP address is also the host.
    # $CANDIDATE is a system environment variable used to retrieve the address. If it is not configured, use *.
    # * represents the address of the specified stats network interface card. If the network is not configured, the default is the address of the first network interface card.
    # TODO: https://github.com/ossrs/srs/pull/1679/files#r400917594
    host       10.2.237.42;

    # Create an RTMP media channel based on the received PS RTP packets, no need to create it through the API interface.
    # The RTMP address parameter [stream] is the channel ID in the format chid[ssrc].
    auto_create_channel   off;

    sip {
    # Enable internal SIP signaling in SRS.
    # Set to "on" to use SRS for signaling, or "off" to only forward PS streams.
        enabled on;
        
    # UDP port for SIP listening.
        listen              5060;
        
    # SIP server ID.
    # The device configuration number needs to be consistent with this value, otherwise registration will fail.
        serial              34020000002000000001;

    # SIP server domain.

        realm               3402000000;

    # Timeout for receiving response after sending ACK from the server, in seconds.
    # If no response is received within the specified time, it is considered a failure.
        ack_timeout         30;

    # Device heartbeat maintenance time, if no heartbeat is received within the specified time (in seconds),
    # the device is considered offline.
        keepalive_timeout   120;

    # Whether to automatically send an invite to the device after registration
    # on: yes  off: no, it needs to be controlled through the API.
        auto_play           on;
    # Whether the port for sending streams from the device is fixed
    # on: send streams to a multiplexing port like 9000
    # off: automatically select a port from the range between rtp_mix_port and rtp_max_port that is available.
        invite_port_fixed     on;

    # Interval for querying the device list from the device or subdomain, in seconds
    # Default is 60 seconds
        query_catalog_interval  60;
    }
}
vhost __defaultVhost__ {
    hls {
        enabled         on;
        hls_fragment    10;
        hls_window      60;
        hls_path        ./objs/nginx/html;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
    }
    rtc {
        enabled     on;
        bframe      discard;
    }
}


Replay

How to replay bug?

Steps to reproduce the bug

Steps to reproduce the bug:

  1. Login to Hikvision NVR.
  2. Run srs_gb28181.html.
  3. Play RTC.

Expected behavior:

> Find issues, fix bugs

TRANS_BY_GPT3

Metadata

Metadata

Assignees

Labels

BugIt might be a bug.GB28181For GB28181.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions