mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
mp4录制完成后是否进行二次关键帧索引写入头部
This commit is contained in:
parent
7608aa6fa9
commit
f0deafd722
@ -117,6 +117,8 @@ fileSecond=3600
|
||||
#mp4点播每次流化数据量,单位毫秒,
|
||||
#减少该值可以让点播数据发送量更平滑,增大该值则更节省cpu资源
|
||||
sampleMS=100
|
||||
#mp4录制完成后是否进行二次关键帧索引写入头部
|
||||
fastStart=0
|
||||
#MP4点播(rtsp/rtmp/http-flv/ws-flv)是否循环播放文件
|
||||
fileRepeat=0
|
||||
|
||||
|
@ -271,6 +271,9 @@ const string kFilePath = RECORD_FIELD"filePath";
|
||||
//mp4文件写缓存大小
|
||||
const string kFileBufSize = RECORD_FIELD"fileBufSize";
|
||||
|
||||
//mp4录制完成后是否进行二次关键帧索引写入头部
|
||||
const string kFastStart = RECORD_FIELD"fastStart";
|
||||
|
||||
//mp4文件是否重头循环读取
|
||||
const string kFileRepeat = RECORD_FIELD"fileRepeat";
|
||||
|
||||
@ -280,6 +283,7 @@ onceToken token([](){
|
||||
mINI::Instance()[kFileSecond] = RECORD_FILE_SECOND;
|
||||
mINI::Instance()[kFilePath] = RECORD_FILE_PATH;
|
||||
mINI::Instance()[kFileBufSize] = 64 * 1024;
|
||||
mINI::Instance()[kFastStart] = false;
|
||||
mINI::Instance()[kFileRepeat] = false;
|
||||
},nullptr);
|
||||
|
||||
|
@ -270,6 +270,8 @@ extern const string kFileSecond;
|
||||
extern const string kFilePath;
|
||||
//mp4文件写缓存大小
|
||||
extern const string kFileBufSize;
|
||||
//mp4录制完成后是否进行二次关键帧索引写入头部
|
||||
extern const string kFastStart;
|
||||
//mp4文件是否重头循环读取
|
||||
extern const string kFileRepeat;
|
||||
} //namespace Record
|
||||
|
@ -584,6 +584,7 @@ void HttpSession::Handle_Req_GET(int64_t &content_len) {
|
||||
if (iRangeEnd == 0) {
|
||||
iRangeEnd = tFileStat.st_size - 1;
|
||||
}
|
||||
auto httpHeader = makeHttpHeader(bClose, iRangeEnd - iRangeStart + 1, get_mime_type(strFile.data()));
|
||||
const char *pcHttpResult = NULL;
|
||||
if (strRange.size() == 0) {
|
||||
//全部下载
|
||||
@ -592,9 +593,6 @@ void HttpSession::Handle_Req_GET(int64_t &content_len) {
|
||||
//分节下载
|
||||
pcHttpResult = "206 Partial Content";
|
||||
fseek(pFilePtr.get(), iRangeStart, SEEK_SET);
|
||||
}
|
||||
auto httpHeader = makeHttpHeader(bClose, iRangeEnd - iRangeStart + 1, get_mime_type(strFile.data()));
|
||||
if (strRange.size() != 0) {
|
||||
//分节下载返回Content-Range头
|
||||
httpHeader.emplace("Content-Range",StrPrinter<<"bytes " << iRangeStart << "-" << iRangeEnd << "/" << tFileStat.st_size<< endl);
|
||||
}
|
||||
|
@ -33,11 +33,11 @@
|
||||
namespace mediakit{
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define fseek64 _fseeki64
|
||||
#define ftell64 _ftelli64
|
||||
#define fseek64 _fseeki64
|
||||
#define ftell64 _ftelli64
|
||||
#else
|
||||
#define fseek64 fseek
|
||||
#define ftell64 ftell
|
||||
#define fseek64 fseek
|
||||
#define ftell64 ftell
|
||||
#endif
|
||||
|
||||
void MP4MuxerBase::init(int flags) {
|
||||
@ -236,7 +236,9 @@ MP4MuxerFile::MP4MuxerFile(const char *file) {
|
||||
fclose(fp);
|
||||
});
|
||||
|
||||
init(MOV_FLAG_FASTSTART);
|
||||
GET_CONFIG(bool, mp4FastStart, Record::kFastStart);
|
||||
|
||||
init(mp4FastStart ? MOV_FLAG_FASTSTART : 0);
|
||||
}
|
||||
|
||||
MP4MuxerFile::~MP4MuxerFile() {
|
||||
@ -254,15 +256,6 @@ int MP4MuxerFile::onWrite(const void *data, uint64_t bytes) {
|
||||
return bytes == fwrite(data, 1, bytes, _file.get()) ? 0 : ferror(_file.get());
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define fseek64 _fseeki64
|
||||
#define ftell64 _ftelli64
|
||||
#else
|
||||
#define fseek64 fseek
|
||||
#define ftell64 ftell
|
||||
#endif
|
||||
|
||||
int MP4MuxerFile::onSeek(uint64_t offset) {
|
||||
return fseek64(_file.get(), offset, SEEK_SET);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user