Mp4: fixed streaming if moov atom is at buffer edge.
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index 80c7ed8..eb51ab2 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -1024,6 +1024,10 @@
+ NGX_HTTP_MP4_MOOV_BUFFER_EXCESS * no_mdat;
}
+ if (ngx_http_mp4_read(mp4, 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;