# HG changeset patch # User Sergey Kandaurov # Date 1395669310 -14400 # Node ID a23c35496c2fc0ba9a34d968c2ca6d1f9374f8a8 # Parent 345e4fd4bb64f1b3ad48a20b69f62bcd39a443c9 Mp4: skipped empty stss atom table in output. The atom may have no data entries after cropping. This fixes "zero size buf in output" alerts. diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -2273,16 +2273,21 @@ ngx_http_mp4_update_stss_atom(ngx_http_m ngx_http_mp4_crop_stss_data(mp4, trak, 1); ngx_http_mp4_crop_stss_data(mp4, trak, 0); - entry = (uint32_t *) data->pos; - end = (uint32_t *) data->last; - - start_sample = trak->start_sample; - - while (entry < end) { - sample = ngx_mp4_get_32value(entry); - sample -= start_sample; - ngx_mp4_set_32value(entry, sample); - entry++; + if (trak->sync_samples_entries) { + entry = (uint32_t *) data->pos; + end = (uint32_t *) data->last; + + start_sample = trak->start_sample; + + while (entry < end) { + sample = ngx_mp4_get_32value(entry); + sample -= start_sample; + ngx_mp4_set_32value(entry, sample); + entry++; + } + + } else { + trak->out[NGX_HTTP_MP4_STSS_DATA].buf = NULL; } atom_size = sizeof(ngx_http_mp4_stss_atom_t) + (data->last - data->pos);