Skip to content

SrsLiveSource cleanup is different to SrsSrtSource #4093

@lizhongjie9999

Description

@lizhongjie9999

Release v6.0-d5

The original code:

void SrsLiveSource::on_consumer_destroy(SrsLiveConsumer* consumer)
{
    ...
    if (consumers.empty()) {
        play_edge->on_all_client_stop();

        // For edge server, the stream die when the last player quit, because the edge stream is created by player
        // activities, so it should die when all players quit.
        if (_srs_config->get_vhost_is_edge(req->vhost)) {
            stream_die_at_ = srs_get_system_time();
        }

        // When no players, the publisher is idle now.
        publisher_idle_at_ = srs_get_system_time();
    }
}

Code that should be changed, Similar to SrsSrtSource::on_consumer_destroy():

void SrsLiveSource::on_consumer_destroy(SrsLiveConsumer* consumer)
{
    ...
    if (consumers.empty()) {
        play_edge->on_all_client_stop();

        // For edge server, the stream die when the last player quit, because the edge stream is created by player
        // activities, so it should die when all players quit.
        if (_srs_config->get_vhost_is_edge(req->vhost)) {
            stream_die_at_ = srs_get_system_time();
        } else if (_can_publish) {  // should die when no publishers and consumers.
            stream_die_at_ = srs_get_system_time();
        }

        // When no players, the publisher is idle now.
        publisher_idle_at_ = srs_get_system_time();
    }
}

Metadata

Metadata

Assignees

Labels

EnglishNativeThis issue is conveyed exclusively in English.EnhancementImprovement or enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions