From 7afd3415b39c245c11956ab038e06df090d4ccef Mon Sep 17 00:00:00 2001
From: Thulinma <jaron@vietors.com>
Date: Tue, 26 Jul 2016 13:57:24 +0200
Subject: [PATCH] Fixed support for VoD assets with a > 8MiB header size

---
 lib/dtscmeta.cpp | 3 ++-
 src/io.cpp       | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/dtscmeta.cpp b/lib/dtscmeta.cpp
index 5072136e..d1b13ed4 100644
--- a/lib/dtscmeta.cpp
+++ b/lib/dtscmeta.cpp
@@ -1481,8 +1481,9 @@ namespace DTSC {
     if (type == "") {
       result << "metadata_" << trackID;
       return result.str();
+    }else{
+      result << type << "_";
     }
-    result << type << "_";
     result << codec << "_";
     if (type == "audio") {
       result << channels << "ch_";
diff --git a/src/io.cpp b/src/io.cpp
index b4ef7a73..454aa32f 100644
--- a/src/io.cpp
+++ b/src/io.cpp
@@ -16,7 +16,11 @@ namespace Mist {
     //Open the page for the metadata
     char pageName[NAME_BUFFER_SIZE];
     snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
-    nProxy.metaPages[0].init(pageName, DEFAULT_STRM_PAGE_SIZE, true);
+    if (myMeta.live){
+      nProxy.metaPages[0].init(pageName, DEFAULT_STRM_PAGE_SIZE, true);
+    }else{
+      nProxy.metaPages[0].init(pageName, myMeta.getSendLen(), true);
+    }
     //Make sure we don't delete it on accident
     nProxy.metaPages[0].master = false;