mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
HLS: Refine sequence no.
This commit is contained in:
parent
1668ba705c
commit
635bb139a2
1 changed files with 3 additions and 6 deletions
|
@ -407,16 +407,13 @@ srs_error_t SrsHlsMuxer::restore_stream()
|
|||
if ((err = fr.read(fbuf, nb_fbuf, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read data");
|
||||
}
|
||||
fr.close();
|
||||
|
||||
std::string body(fbuf, nb_fbuf);
|
||||
|
||||
// parse
|
||||
std::string body(fbuf, nb_fbuf);
|
||||
if (body.empty()) {
|
||||
return srs_error_wrap(err, "read empty m3u8");
|
||||
}
|
||||
|
||||
int sequence_num = 0;
|
||||
srs_utime_t max_target_duration = 0;
|
||||
bool discon = false;
|
||||
|
||||
|
@ -455,7 +452,7 @@ srs_error_t SrsHlsMuxer::restore_stream()
|
|||
// #EXT-X-MEDIA-SEQUENCE:4294967295
|
||||
// the media sequence no.
|
||||
if (srs_string_starts_with(line, "#EXT-X-MEDIA-SEQUENCE:")) {
|
||||
sequence_num = ::atof(line.substr(string("#EXT-X-MEDIA-SEQUENCE:").length()).c_str());
|
||||
_sequence_no = ::atof(line.substr(string("#EXT-X-MEDIA-SEQUENCE:").length()).c_str());
|
||||
}
|
||||
|
||||
// #EXT-X-TARGETDURATION:12
|
||||
|
@ -531,7 +528,7 @@ srs_error_t SrsHlsMuxer::restore_stream()
|
|||
|
||||
// new segment.
|
||||
SrsHlsSegment* seg = new SrsHlsSegment(context, default_acodec, default_vcodec, writer);
|
||||
seg->sequence_no = sequence_num++;
|
||||
seg->sequence_no = _sequence_no++;
|
||||
seg->set_path(hls_path + "/" + req->app + "/" + ts_url);
|
||||
seg->uri = ts_url;
|
||||
seg->set_sequence_header(discon);
|
||||
|
|
Loading…
Reference in a new issue