[nginx] svn commit: r4728 - in branches/stable-1.2: . src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Jul 2 16:56:54 UTC 2012


Author: mdounin
Date: 2012-07-02 16:56:53 +0000 (Mon, 02 Jul 2012)
New Revision: 4728
URL: http://trac.nginx.org/nginx/changeset/4728/nginx

Log:
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.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/modules/ngx_http_mp4_module.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-07-02 16:53:36 UTC (rev 4727)
+++ branches/stable-1.2	2012-07-02 16:56:53 UTC (rev 4728)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4687,4692,4694-4696,4699,4704-4705
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4689,4692,4694-4696,4699,4704-4706
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_mp4_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_mp4_module.c	2012-07-02 16:53:36 UTC (rev 4727)
+++ branches/stable-1.2/src/http/modules/ngx_http_mp4_module.c	2012-07-02 16:56:53 UTC (rev 4728)
@@ -1024,6 +1024,10 @@
                          + NGX_HTTP_MP4_MOOV_BUFFER_EXCESS * no_mdat;
     }
 
+    if (ngx_http_mp4_read(mp4, (size_t) atom_data_size) != NGX_OK) {
+        return NGX_ERROR;
+    }
+
     mp4->trak.elts = &mp4->traks;
     mp4->trak.size = sizeof(ngx_http_mp4_trak_t);
     mp4->trak.nalloc = 2;
@@ -1044,6 +1048,12 @@
         mp4->buffer_start = mp4->buffer_pos;
         mp4->buffer_size = NGX_HTTP_MP4_MOOV_BUFFER_EXCESS;
 
+        if (mp4->buffer_start + mp4->buffer_size > mp4->buffer_end) {
+            mp4->buffer = NULL;
+            mp4->buffer_pos = NULL;
+            mp4->buffer_end = NULL;
+        }
+
     } else {
         /* skip atoms after moov atom */
         mp4->offset = mp4->end;
@@ -2488,8 +2498,14 @@
 
     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);
         ngx_mp4_set_32value(first->samples, samples - trak->chunk_samples);
@@ -2504,6 +2520,7 @@
 
         ngx_mp4_set_32value(entry->chunk, 2);
 
+        entries++;
         atom_size += sizeof(ngx_mp4_stsc_entry_t);
     }
 



More information about the nginx-devel mailing list