Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: last segment of ts not trigger 'on_hls' #2438

Merged
merged 1 commit into from
Jun 27, 2021

Conversation

duiniuluantanqin
Copy link
Member

@duiniuluantanqin duiniuluantanqin commented Jun 24, 2021

fix bug: last segment of ts not trigger 'on_hls', because of 'on_unpublish' earlier than 'segment_close',
see #2068

Phenomenon: After the streaming ends, the last HLS segment does not trigger on_hls.
Cause: In the function SrsHlsController::on_unpublish(), on_unpublish occurs earlier than segment_close, causing the notification of the last segment to be forgotten in the tasks.
Solution: Place on_unpublish after segment_close.

srs_error_t SrsHlsController::on_unpublish()
{
    srs_error_t err = srs_success;

    if ((err = muxer->on_unpublish()) != srs_success) {    
        return srs_error_wrap(err, "muxer unpublish");                
    }           
                                                                                   
    if ((err = muxer->flush_audio(tsmc)) != srs_success) {           
        return srs_error_wrap(err, "hls: flush audio");                     
    }       
                                                                                       
    if ((err = muxer->segment_close()) != srs_success) {              
        return srs_error_wrap(err, "hls: segment close");                
    }     
                                                       
    return err;
}

TRANS_BY_GPT3

@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2021

Codecov Report

Merging #2438 (9648d65) into develop (a594678) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2438      +/-   ##
===========================================
- Coverage    42.77%   42.77%   -0.01%     
===========================================
  Files          101      101              
  Lines        35944    35944              
===========================================
- Hits         15376    15375       -1     
- Misses       20568    20569       +1     

| Impacted Files | Coverage Δ | |'

Translated to English while maintaining the markdown structure:

'| Impacted Files | Coverage Δ | |
|---|---|---|
| trunk/src/app/srs_app_hls.cpp | 0.00% <0.00%> (ø) | |'

Translated to English while maintaining the markdown structure:

'| trunk/src/app/srs_app_hls.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/protocol/srs_service_utility.cpp | 72.43% <0.00%> (-0.55%) | ⬇️ |


Continue to review full report at Codecov.

Legend - Click here to learn more
| Δ = absolute <relative> (impact), ø = not affected, ? = missing data |

Translated to English while maintaining the markdown structure:

| Δ = absolute <relative> (impact), ø = not affected, ? = missing data |

Powered by Codecov. Last update a594678...9648d65. Read the comment docs.

TRANS_BY_GPT3

@winlinvip winlinvip merged commit d987e19 into ossrs:develop Jun 27, 2021
winlinvip pushed a commit that referenced this pull request Jun 27, 2021
fix bug: last segment of ts not trigger 'on_hls',
because of 'on_unpublish' earlier than 'segment_close' (#2438)
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After the end of the live streaming, there is an issue with not posting the last on_hls.
4 participants