正在显示
4 个修改的文件
包含
12 行增加
和
0 行删除
| @@ -104,6 +104,7 @@ int SrsFileBuffer::fullfill(const char* filename) | @@ -104,6 +104,7 @@ int SrsFileBuffer::fullfill(const char* filename) | ||
| 104 | int nread = 0; | 104 | int nread = 0; |
| 105 | int filesize = 0; | 105 | int filesize = 0; |
| 106 | 106 | ||
| 107 | + // TODO: FIXME: refine the file stream. | ||
| 107 | if ((fd = ::open(filename, O_RDONLY, 0)) < 0) { | 108 | if ((fd = ::open(filename, O_RDONLY, 0)) < 0) { |
| 108 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 109 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| 109 | srs_error("open conf file error. ret=%d", ret); | 110 | srs_error("open conf file error. ret=%d", ret); |
| @@ -37,6 +37,13 @@ class SrsAmf0Object; | @@ -37,6 +37,13 @@ class SrsAmf0Object; | ||
| 37 | class SrsSharedPtrMessage; | 37 | class SrsSharedPtrMessage; |
| 38 | 38 | ||
| 39 | /** | 39 | /** |
| 40 | +* encode data to flv file. | ||
| 41 | +*/ | ||
| 42 | +class SrsFlvEncoder | ||
| 43 | +{ | ||
| 44 | +}; | ||
| 45 | + | ||
| 46 | +/** | ||
| 40 | * dvr(digital video recorder) to record RTMP stream to flv file. | 47 | * dvr(digital video recorder) to record RTMP stream to flv file. |
| 41 | * TODO: FIXME: add utest for it. | 48 | * TODO: FIXME: add utest for it. |
| 42 | */ | 49 | */ |
| @@ -152,6 +152,7 @@ public: | @@ -152,6 +152,7 @@ public: | ||
| 152 | { | 152 | { |
| 153 | int ret = ERROR_SUCCESS; | 153 | int ret = ERROR_SUCCESS; |
| 154 | 154 | ||
| 155 | + // TODO: FIXME: maybe should use st_write. | ||
| 155 | if (::write(fd, mpegts_header, sizeof(mpegts_header)) != sizeof(mpegts_header)) { | 156 | if (::write(fd, mpegts_header, sizeof(mpegts_header)) != sizeof(mpegts_header)) { |
| 156 | ret = ERROR_HLS_WRITE_FAILED; | 157 | ret = ERROR_HLS_WRITE_FAILED; |
| 157 | srs_error("write ts file header failed. ret=%d", ret); | 158 | srs_error("write ts file header failed. ret=%d", ret); |
| @@ -276,6 +277,7 @@ public: | @@ -276,6 +277,7 @@ public: | ||
| 276 | } | 277 | } |
| 277 | 278 | ||
| 278 | // write ts packet | 279 | // write ts packet |
| 280 | + // TODO: FIXME: maybe should use st_write. | ||
| 279 | if (::write(fd, packet, sizeof(packet)) != sizeof(packet)) { | 281 | if (::write(fd, packet, sizeof(packet)) != sizeof(packet)) { |
| 280 | ret = ERROR_HLS_WRITE_FAILED; | 282 | ret = ERROR_HLS_WRITE_FAILED; |
| 281 | srs_error("write ts file failed. ret=%d", ret); | 283 | srs_error("write ts file failed. ret=%d", ret); |
| @@ -428,6 +430,7 @@ int SrsTSMuxer::open(string _path) | @@ -428,6 +430,7 @@ int SrsTSMuxer::open(string _path) | ||
| 428 | 430 | ||
| 429 | int flags = O_CREAT|O_WRONLY|O_TRUNC; | 431 | int flags = O_CREAT|O_WRONLY|O_TRUNC; |
| 430 | mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; | 432 | mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; |
| 433 | + // TODO: FIXME: refine the file stream. | ||
| 431 | if ((fd = ::open(path.c_str(), flags, mode)) < 0) { | 434 | if ((fd = ::open(path.c_str(), flags, mode)) < 0) { |
| 432 | ret = ERROR_HLS_OPEN_FAILED; | 435 | ret = ERROR_HLS_OPEN_FAILED; |
| 433 | srs_error("open ts file %s failed. ret=%d", path.c_str(), ret); | 436 | srs_error("open ts file %s failed. ret=%d", path.c_str(), ret); |
| @@ -163,6 +163,7 @@ int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req) | @@ -163,6 +163,7 @@ int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req) | ||
| 163 | 163 | ||
| 164 | std::string fullpath = get_request_file(req); | 164 | std::string fullpath = get_request_file(req); |
| 165 | 165 | ||
| 166 | + // TODO: FIXME: refine the file stream. | ||
| 166 | int fd = ::open(fullpath.c_str(), O_RDONLY); | 167 | int fd = ::open(fullpath.c_str(), O_RDONLY); |
| 167 | if (fd < 0) { | 168 | if (fd < 0) { |
| 168 | ret = ERROR_HTTP_OPEN_FILE; | 169 | ret = ERROR_HTTP_OPEN_FILE; |
-
请 注册 或 登录 后发表评论