Made the maximum cluster size smaller for live streams and even smaller for live audio only streams
This commit is contained in:
parent
3cea8ad970
commit
e6826dca0e
1 changed files with 9 additions and 7 deletions
|
@ -79,7 +79,7 @@ struct mk_mux {
|
|||
htsbuf_queue_t *cluster;
|
||||
int64_t cluster_tc;
|
||||
off_t cluster_pos;
|
||||
|
||||
int cluster_maxsize;
|
||||
|
||||
off_t segment_header_pos;
|
||||
|
||||
|
@ -706,6 +706,7 @@ mk_mux_create(const char *filename,
|
|||
mkm->filename = strdup(filename);
|
||||
mkm->fd = fd;
|
||||
mkm->title = strdup(de->de_title);
|
||||
mkm->cluster_maxsize = 2*1024*1024; //2Mb
|
||||
TAILQ_INIT(&mkm->cues);
|
||||
|
||||
mk_write_master(mkm, 0x1a45dfa3, mk_build_ebmlheader());
|
||||
|
@ -760,6 +761,11 @@ mk_mux_stream_create(int fd, const struct streaming_start *ss,
|
|||
|
||||
mk_write_queue(mkm, &q);
|
||||
|
||||
if(mkm->has_video)
|
||||
mkm->cluster_maxsize = 100*1024; //200Kb
|
||||
else
|
||||
mkm->cluster_maxsize = 10*1024; //20Kb
|
||||
|
||||
return mkm;
|
||||
}
|
||||
|
||||
|
@ -804,7 +810,6 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt)
|
|||
|
||||
uint8_t *data;
|
||||
size_t len;
|
||||
const int clusersizemax = 2000000;
|
||||
|
||||
if(pts == PTS_UNSET)
|
||||
// This is our best guess, it might be wrong but... oh well
|
||||
|
@ -830,13 +835,10 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt)
|
|||
return;
|
||||
}
|
||||
|
||||
if(vkeyframe && mkm->cluster && mkm->cluster->hq_size > clusersizemax/4)
|
||||
if(vkeyframe && mkm->cluster && mkm->cluster->hq_size > mkm->cluster_maxsize / 4)
|
||||
mk_close_cluster(mkm);
|
||||
|
||||
else if(mkm->cluster && mkm->cluster->hq_size > clusersizemax)
|
||||
mk_close_cluster(mkm);
|
||||
|
||||
else if(!mkm->has_video && mkm->cluster && mkm->cluster->hq_size > clusersizemax/40)
|
||||
else if(mkm->cluster && mkm->cluster->hq_size > mkm->cluster_maxsize)
|
||||
mk_close_cluster(mkm);
|
||||
|
||||
if(mkm->cluster == NULL) {
|
||||
|
|
Loading…
Add table
Reference in a new issue