Klaus Demo nginx / 02f8e0e
Merge of r4688, r4689, r4706: *) Mp4: fixed non-keyframe seeks in some cases (ticket #175). Number of entries in stsc atom was wrong if we've added an entry to split a chunk. Additionally, there is no need to add an entry if we are going to split last chunk in an entry, it's enough to update the entry we already have. Previously new entry was added and old one was left as is, resulting in incorrect entry with zero chunks which might confuse some software. *) Mp4: fixed streaming if moov atom is at buffer edge. Maxim Dounin 9 years ago
1 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
10231023 + NGX_HTTP_MP4_MOOV_BUFFER_EXCESS * no_mdat;
10241024 }
10251025
1026 if (ngx_http_mp4_read(mp4, (size_t) atom_data_size) != NGX_OK) {
1027 return NGX_ERROR;
1028 }
1029
10261030 mp4->trak.elts = &mp4->traks;
10271031 mp4->trak.size = sizeof(ngx_http_mp4_trak_t);
10281032 mp4->trak.nalloc = 2;
10421046 if (no_mdat) {
10431047 mp4->buffer_start = mp4->buffer_pos;
10441048 mp4->buffer_size = NGX_HTTP_MP4_MOOV_BUFFER_EXCESS;
1049
1050 if (mp4->buffer_start + mp4->buffer_size > mp4->buffer_end) {
1051 mp4->buffer = NULL;
1052 mp4->buffer_pos = NULL;
1053 mp4->buffer_end = NULL;
1054 }
10451055
10461056 } else {
10471057 /* skip atoms after moov atom */
24872497
24882498 ngx_mp4_set_32value(entry->chunk, 1);
24892499
2490 if (trak->chunk_samples) {
2500 if (trak->chunk_samples && next_chunk - trak->start_chunk == 2) {
2501
2502 /* last chunk in the entry */
2503
2504 ngx_mp4_set_32value(entry->samples, samples - trak->chunk_samples);
2505
2506 } else if (trak->chunk_samples) {
24912507
24922508 first = &trak->stsc_chunk_entry;
24932509 ngx_mp4_set_32value(first->chunk, 1);
25032519
25042520 ngx_mp4_set_32value(entry->chunk, 2);
25052521
2522 entries++;
25062523 atom_size += sizeof(ngx_mp4_stsc_entry_t);
25072524 }
25082525