summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-06-18 14:01:18 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-06-18 14:01:18 +0000
commite1e2e2eb3a987de63efedc55f0abcda384d7eccc (patch)
treefd86ebc9bf2fee8642e349925f99cdf9faeb121c
parent0cf52376fbe5724f21a00f65639eb032fcb14e5f (diff)
downloadnginx-e1e2e2eb3a987de63efedc55f0abcda384d7eccc.tar.gz
nginx-e1e2e2eb3a987de63efedc55f0abcda384d7eccc.tar.bz2
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.
-rw-r--r--src/http/modules/ngx_http_mp4_module.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index 2c8cfd171..80c7ed853 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -2488,7 +2488,13 @@ found:
ngx_mp4_set_32value(entry->chunk, 1);
- if (trak->chunk_samples) {
+ if (trak->chunk_samples && next_chunk - trak->start_chunk == 2) {
+
+ /* last chunk in the entry */
+
+ ngx_mp4_set_32value(entry->samples, samples - trak->chunk_samples);
+
+ } else if (trak->chunk_samples) {
first = &trak->stsc_chunk_entry;
ngx_mp4_set_32value(first->chunk, 1);
@@ -2504,6 +2510,7 @@ found:
ngx_mp4_set_32value(entry->chunk, 2);
+ entries++;
atom_size += sizeof(ngx_mp4_stsc_entry_t);
}