正在显示
1 个修改的文件
包含
19 行增加
和
16 行删除
@@ -49,6 +49,9 @@ void close_flv_file(int flv_fd); | @@ -49,6 +49,9 @@ void close_flv_file(int flv_fd); | ||
49 | int flv_open_ic(int flv_fd); | 49 | int flv_open_ic(int flv_fd); |
50 | int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, int* size); | 50 | int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, int* size); |
51 | 51 | ||
52 | +int64_t re_create(); | ||
53 | +int64_t re_update(int64_t re, u_int32_t time); | ||
54 | + | ||
52 | int main(int argc, char** argv) | 55 | int main(int argc, char** argv) |
53 | { | 56 | { |
54 | int ret = 0; | 57 | int ret = 0; |
@@ -105,7 +108,7 @@ int main(int argc, char** argv) | @@ -105,7 +108,7 @@ int main(int argc, char** argv) | ||
105 | ortmp = srs_rtmp_create(out_rtmp_url); | 108 | ortmp = srs_rtmp_create(out_rtmp_url); |
106 | 109 | ||
107 | ret = proxy(flv_fd, ortmp); | 110 | ret = proxy(flv_fd, ortmp); |
108 | - trace("proxy completed"); | 111 | + trace("ingest flv to RTMP completed"); |
109 | 112 | ||
110 | srs_rtmp_destroy(ortmp); | 113 | srs_rtmp_destroy(ortmp); |
111 | close_flv_file(flv_fd); | 114 | close_flv_file(flv_fd); |
@@ -113,20 +116,6 @@ int main(int argc, char** argv) | @@ -113,20 +116,6 @@ int main(int argc, char** argv) | ||
113 | return ret; | 116 | return ret; |
114 | } | 117 | } |
115 | 118 | ||
116 | -int64_t re_create() | ||
117 | -{ | ||
118 | - return 0; | ||
119 | -} | ||
120 | -int64_t re_update(int64_t re, u_int32_t time) | ||
121 | -{ | ||
122 | - if (time - re > 500) { | ||
123 | - usleep((time - re) * 1000); | ||
124 | - return time; | ||
125 | - } | ||
126 | - | ||
127 | - return re; | ||
128 | -} | ||
129 | - | ||
130 | int proxy(int flv_fd, srs_rtmp_t ortmp) | 119 | int proxy(int flv_fd, srs_rtmp_t ortmp) |
131 | { | 120 | { |
132 | int ret = 0; | 121 | int ret = 0; |
@@ -145,7 +134,7 @@ int proxy(int flv_fd, srs_rtmp_t ortmp) | @@ -145,7 +134,7 @@ int proxy(int flv_fd, srs_rtmp_t ortmp) | ||
145 | return ret; | 134 | return ret; |
146 | } | 135 | } |
147 | 136 | ||
148 | - trace("start proxy RTMP stream"); | 137 | + trace("start ingest flv to RTMP stream"); |
149 | for (;;) { | 138 | for (;;) { |
150 | if ((ret = flv_read_packet(flv_fd, &type, ×tamp, &data, &size)) != 0) { | 139 | if ((ret = flv_read_packet(flv_fd, &type, ×tamp, &data, &size)) != 0) { |
151 | trace("irtmp get packet failed. ret=%d", ret); | 140 | trace("irtmp get packet failed. ret=%d", ret); |
@@ -192,6 +181,20 @@ int connect_oc(srs_rtmp_t ortmp) | @@ -192,6 +181,20 @@ int connect_oc(srs_rtmp_t ortmp) | ||
192 | return ret; | 181 | return ret; |
193 | } | 182 | } |
194 | 183 | ||
184 | +int64_t re_create() | ||
185 | +{ | ||
186 | + return 0; | ||
187 | +} | ||
188 | +int64_t re_update(int64_t re, u_int32_t time) | ||
189 | +{ | ||
190 | + if (time - re > 500) { | ||
191 | + usleep((time - re) * 1000); | ||
192 | + return time; | ||
193 | + } | ||
194 | + | ||
195 | + return re; | ||
196 | +} | ||
197 | + | ||
195 | int open_flv_file(char* in_flv_file) | 198 | int open_flv_file(char* in_flv_file) |
196 | { | 199 | { |
197 | return open(in_flv_file, O_RDONLY); | 200 | return open(in_flv_file, O_RDONLY); |
-
请 注册 或 登录 后发表评论