mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #2549: Fix duration issue for HLS on_hls. v4.0.176
This commit is contained in:
parent
d6064ac608
commit
eb3bbf1bca
5 changed files with 23 additions and 8 deletions
|
@ -8,6 +8,7 @@ The changelog for SRS.
|
|||
|
||||
## SRS 4.0 Changelog
|
||||
|
||||
* v4.0, 2021-10-12, Merge [#2549](https://github.com/ossrs/srs/pull/2549): Fix duration issue for HLS on_hls. v4.0.176
|
||||
* v4.0, 2021-10-11, Fix [#1641](https://github.com/ossrs/srs/issues/1641), HLS/RTC picture corrupt for SPS/PPS lost. v4.0.175
|
||||
* v4.0, 2021-10-11, RTC: Refine config, aac to rtmp_to_rtc, bframe to keep_bframe. v4.0.174
|
||||
* v4.0, 2021-10-10, For [#1641](https://github.com/ossrs/srs/issues/1641), Support RTMP publish and play regression test. v4.0.173
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
for file in $(git remote); do echo ""; git push $file $@; done
|
||||
#for file in $(git remote); do echo ""; git push $file $@; done
|
||||
for file in $(git remote -v|grep -v https|grep push|awk '{print $1}'); do echo ""; echo "git push $file $@"; git push $file $@; done
|
||||
|
||||
|
|
|
@ -63,6 +63,17 @@ void SrsHlsSegment::config_cipher(unsigned char* key,unsigned char* iv)
|
|||
|
||||
SrsEncFileWriter* fw = (SrsEncFileWriter*)writer;
|
||||
fw->config_cipher(key, iv);
|
||||
}
|
||||
|
||||
srs_error_t SrsHlsSegment::rename()
|
||||
{
|
||||
if (true) {
|
||||
std::stringstream ss;
|
||||
ss << srsu2msi(duration());
|
||||
uri = srs_string_replace(uri, "[duration]", ss.str());
|
||||
}
|
||||
|
||||
return SrsFragment::rename();
|
||||
}
|
||||
|
||||
SrsDvrAsyncCallOnHls::SrsDvrAsyncCallOnHls(SrsContextId c, SrsRequest* r, string p, string t, string m, string mu, int s, srs_utime_t d)
|
||||
|
@ -607,6 +618,11 @@ srs_error_t SrsHlsMuxer::do_segment_close()
|
|||
bool matchMinDuration = current->duration() >= SRS_HLS_SEGMENT_MIN_DURATION;
|
||||
bool matchMaxDuration = current->duration() <= max_td * 2 * 1000;
|
||||
if (matchMinDuration && matchMaxDuration) {
|
||||
// rename from tmp to real path
|
||||
if ((err = current->rename()) != srs_success) {
|
||||
return srs_error_wrap(err, "rename");
|
||||
}
|
||||
|
||||
// use async to call the http hooks, for it will cause thread switch.
|
||||
if ((err = async->execute(new SrsDvrAsyncCallOnHls(_srs_context->get_id(), req, current->fullpath(),
|
||||
current->uri, m3u8, m3u8_url, current->sequence_no, current->duration()))) != srs_success) {
|
||||
|
@ -620,12 +636,7 @@ srs_error_t SrsHlsMuxer::do_segment_close()
|
|||
|
||||
// close the muxer of finished segment.
|
||||
srs_freep(current->tscw);
|
||||
|
||||
// rename from tmp to real path
|
||||
if ((err = current->rename()) != srs_success) {
|
||||
return srs_error_wrap(err, "rename");
|
||||
}
|
||||
|
||||
|
||||
segments->append(current);
|
||||
current = NULL;
|
||||
} else {
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
virtual ~SrsHlsSegment();
|
||||
public:
|
||||
void config_cipher(unsigned char* key,unsigned char* iv);
|
||||
// replace the placeholder
|
||||
virtual srs_error_t rename();
|
||||
};
|
||||
|
||||
// The hls async call: on_hls
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 175
|
||||
#define VERSION_REVISION 176
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue