正在显示
14 个修改的文件
包含
468 行增加
和
33 行删除
@@ -446,8 +446,10 @@ Supported operating systems and hardware: | @@ -446,8 +446,10 @@ Supported operating systems and hardware: | ||
446 | [EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_SrsLibrtmp#publish-h264-raw-data) | 446 | [EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_SrsLibrtmp#publish-h264-raw-data) |
447 | ) by srs-librtmp. | 447 | ) by srs-librtmp. |
448 | 1. Support [6k+ clients](https://github.com/winlinvip/simple-rtmp-server/issues/194), 4Gbps per process. | 448 | 1. Support [6k+ clients](https://github.com/winlinvip/simple-rtmp-server/issues/194), 4Gbps per process. |
449 | -1. [dev] Suppport [English wiki](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_Home). | ||
450 | -1. [dev] Research and simplify st, [bug #182](https://github.com/winlinvip/simple-rtmp-server/issues/182). | 449 | +1. Suppport [English wiki](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_Home). |
450 | +1. Research and simplify st, [bug #182](https://github.com/winlinvip/simple-rtmp-server/issues/182). | ||
451 | +1. Support compile [srs-librtmp on windows](https://github.com/winlinvip/srs.librtmp), | ||
452 | +[bug #213](https://github.com/winlinvip/simple-rtmp-server/issues/213). | ||
451 | 1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech). | 453 | 1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech). |
452 | 1. [no-plan] Support RTMP 302 redirect [#92](https://github.com/winlinvip/simple-rtmp-server/issues/92). | 454 | 1. [no-plan] Support RTMP 302 redirect [#92](https://github.com/winlinvip/simple-rtmp-server/issues/92). |
453 | 1. [no-plan] Support multiple processes, for both origin and edge | 455 | 1. [no-plan] Support multiple processes, for both origin and edge |
@@ -480,6 +482,7 @@ Supported operating systems and hardware: | @@ -480,6 +482,7 @@ Supported operating systems and hardware: | ||
480 | * 2013-10-17, Created.<br/> | 482 | * 2013-10-17, Created.<br/> |
481 | 483 | ||
482 | ## History | 484 | ## History |
485 | +* v2.0, 2014-11-19, fix [#213](https://github.com/winlinvip/simple-rtmp-server/issues/213), support compile [srs-librtmp on windows](https://github.com/winlinvip/srs.librtmp), [bug #213](https://github.com/winlinvip/simple-rtmp-server/issues/213). 2.0.26 | ||
483 | * v2.0, 2014-11-18, all wiki translated to English. 2.0.23. | 486 | * v2.0, 2014-11-18, all wiki translated to English. 2.0.23. |
484 | * v2.0, 2014-11-15, fix [#204](https://github.com/winlinvip/simple-rtmp-server/issues/204), srs-librtmp drop duplicated sps/pps(sequence header). 2.0.22. | 487 | * v2.0, 2014-11-15, fix [#204](https://github.com/winlinvip/simple-rtmp-server/issues/204), srs-librtmp drop duplicated sps/pps(sequence header). 2.0.22. |
485 | * v2.0, 2014-11-15, fix [#203](https://github.com/winlinvip/simple-rtmp-server/issues/203), srs-librtmp drop any video before sps/pps(sequence header). 2.0.21. | 488 | * v2.0, 2014-11-15, fix [#203](https://github.com/winlinvip/simple-rtmp-server/issues/203), srs-librtmp drop any video before sps/pps(sequence header). 2.0.21. |
@@ -105,11 +105,13 @@ cat << END >$FILE | @@ -105,11 +105,13 @@ cat << END >$FILE | ||
105 | 105 | ||
106 | int main(int argc, char** argv) | 106 | int main(int argc, char** argv) |
107 | { | 107 | { |
108 | + srs_rtmp_t rtmp; | ||
109 | + | ||
108 | printf("Example for srs-librtmp\n"); | 110 | printf("Example for srs-librtmp\n"); |
109 | printf("SRS(simple-rtmp-server) client librtmp library.\n"); | 111 | printf("SRS(simple-rtmp-server) client librtmp library.\n"); |
110 | printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); | 112 | printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); |
111 | 113 | ||
112 | - srs_rtmp_t rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream"); | 114 | + rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream"); |
113 | srs_lib_trace("create rtmp success"); | 115 | srs_lib_trace("create rtmp success"); |
114 | srs_rtmp_destroy(rtmp); | 116 | srs_rtmp_destroy(rtmp); |
115 | 117 |
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
31 | // current release version | 31 | // current release version |
32 | #define VERSION_MAJOR 2 | 32 | #define VERSION_MAJOR 2 |
33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
34 | -#define VERSION_REVISION 25 | 34 | +#define VERSION_REVISION 26 |
35 | // server info. | 35 | // server info. |
36 | #define RTMP_SIG_SRS_KEY "SRS" | 36 | #define RTMP_SIG_SRS_KEY "SRS" |
37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" | 37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" |
@@ -70,7 +70,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -70,7 +70,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
70 | #ifndef __STDC_FORMAT_MACROS | 70 | #ifndef __STDC_FORMAT_MACROS |
71 | #define __STDC_FORMAT_MACROS | 71 | #define __STDC_FORMAT_MACROS |
72 | #endif | 72 | #endif |
73 | + | ||
74 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
75 | +#ifndef _WIN32 | ||
73 | #include <inttypes.h> | 76 | #include <inttypes.h> |
77 | +#endif | ||
74 | 78 | ||
75 | #include <assert.h> | 79 | #include <assert.h> |
76 | #define srs_assert(expression) assert(expression) | 80 | #define srs_assert(expression) assert(expression) |
@@ -23,8 +23,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,8 +23,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
23 | 23 | ||
24 | #include <srs_kernel_file.hpp> | 24 | #include <srs_kernel_file.hpp> |
25 | 25 | ||
26 | -#include <fcntl.h> | 26 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 |
27 | +#ifndef _WIN32 | ||
27 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | +#endif | ||
30 | + | ||
31 | +#include <fcntl.h> | ||
28 | #include <sstream> | 32 | #include <sstream> |
29 | using namespace std; | 33 | using namespace std; |
30 | 34 | ||
@@ -173,19 +177,19 @@ int64_t SrsFileReader::tellg() | @@ -173,19 +177,19 @@ int64_t SrsFileReader::tellg() | ||
173 | 177 | ||
174 | void SrsFileReader::skip(int64_t size) | 178 | void SrsFileReader::skip(int64_t size) |
175 | { | 179 | { |
176 | - ::lseek(fd, size, SEEK_CUR); | 180 | + ::lseek(fd, (off_t)size, SEEK_CUR); |
177 | } | 181 | } |
178 | 182 | ||
179 | int64_t SrsFileReader::lseek(int64_t offset) | 183 | int64_t SrsFileReader::lseek(int64_t offset) |
180 | { | 184 | { |
181 | - return (int64_t)::lseek(fd, offset, SEEK_SET); | 185 | + return (int64_t)::lseek(fd, (off_t)offset, SEEK_SET); |
182 | } | 186 | } |
183 | 187 | ||
184 | int64_t SrsFileReader::filesize() | 188 | int64_t SrsFileReader::filesize() |
185 | { | 189 | { |
186 | int64_t cur = tellg(); | 190 | int64_t cur = tellg(); |
187 | int64_t size = (int64_t)::lseek(fd, 0, SEEK_END); | 191 | int64_t size = (int64_t)::lseek(fd, 0, SEEK_END); |
188 | - ::lseek(fd, cur, SEEK_SET); | 192 | + ::lseek(fd, (off_t)cur, SEEK_SET); |
189 | return size; | 193 | return size; |
190 | } | 194 | } |
191 | 195 |
@@ -23,8 +23,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,8 +23,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
23 | 23 | ||
24 | #include <srs_kernel_flv.hpp> | 24 | #include <srs_kernel_flv.hpp> |
25 | 25 | ||
26 | -#include <fcntl.h> | 26 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 |
27 | +#ifndef _WIN32 | ||
27 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | +#endif | ||
30 | + | ||
31 | +#include <fcntl.h> | ||
28 | #include <sstream> | 32 | #include <sstream> |
29 | using namespace std; | 33 | using namespace std; |
30 | 34 | ||
@@ -157,7 +161,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size) | @@ -157,7 +161,7 @@ int SrsFlvEncoder::write_audio(int64_t timestamp, char* data, int size) | ||
157 | return ret; | 161 | return ret; |
158 | } | 162 | } |
159 | tag_stream->write_3bytes(size); | 163 | tag_stream->write_3bytes(size); |
160 | - tag_stream->write_3bytes(timestamp); | 164 | + tag_stream->write_3bytes((int32_t)timestamp); |
161 | // default to little-endian | 165 | // default to little-endian |
162 | tag_stream->write_1bytes((timestamp >> 24) & 0xFF); | 166 | tag_stream->write_1bytes((timestamp >> 24) & 0xFF); |
163 | 167 | ||
@@ -191,7 +195,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size) | @@ -191,7 +195,7 @@ int SrsFlvEncoder::write_video(int64_t timestamp, char* data, int size) | ||
191 | return ret; | 195 | return ret; |
192 | } | 196 | } |
193 | tag_stream->write_3bytes(size); | 197 | tag_stream->write_3bytes(size); |
194 | - tag_stream->write_3bytes(timestamp); | 198 | + tag_stream->write_3bytes((int32_t)timestamp); |
195 | // default to little-endian | 199 | // default to little-endian |
196 | tag_stream->write_1bytes((timestamp >> 24) & 0xFF); | 200 | tag_stream->write_1bytes((timestamp >> 24) & 0xFF); |
197 | 201 |
@@ -23,11 +23,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,11 +23,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
23 | 23 | ||
24 | #include <srs_kernel_utility.hpp> | 24 | #include <srs_kernel_utility.hpp> |
25 | 25 | ||
26 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
27 | +#ifndef _WIN32 | ||
26 | #include <unistd.h> | 28 | #include <unistd.h> |
27 | -#include <string.h> | ||
28 | #include <netdb.h> | 29 | #include <netdb.h> |
29 | #include <arpa/inet.h> | 30 | #include <arpa/inet.h> |
30 | #include <sys/time.h> | 31 | #include <sys/time.h> |
32 | +#endif | ||
33 | + | ||
34 | +#include <string.h> | ||
31 | 35 | ||
32 | using namespace std; | 36 | using namespace std; |
33 | 37 |
@@ -23,7 +23,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
23 | 23 | ||
24 | #include <srs_lib_bandwidth.hpp> | 24 | #include <srs_lib_bandwidth.hpp> |
25 | 25 | ||
26 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
27 | +#ifndef _WIN32 | ||
26 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | +#endif | ||
27 | 30 | ||
28 | #include <sstream> | 31 | #include <sstream> |
29 | using namespace std; | 32 | using namespace std; |
@@ -293,11 +296,6 @@ int SrsBandwidthClient::publish_checking(int duration_ms, int play_kbps) | @@ -293,11 +296,6 @@ int SrsBandwidthClient::publish_checking(int duration_ms, int play_kbps) | ||
293 | return ret; | 296 | return ret; |
294 | } | 297 | } |
295 | 298 | ||
296 | - // send play data to client | ||
297 | - int size = 1024; // TODO: FIXME: magic number | ||
298 | - char random_data[size]; | ||
299 | - memset(random_data, 'A', size); | ||
300 | - | ||
301 | int data_count = 1; | 299 | int data_count = 1; |
302 | srs_update_system_time_ms(); | 300 | srs_update_system_time_ms(); |
303 | int64_t starttime = srs_get_system_time_ms(); | 301 | int64_t starttime = srs_get_system_time_ms(); |
@@ -321,13 +319,13 @@ int SrsBandwidthClient::publish_checking(int duration_ms, int play_kbps) | @@ -321,13 +319,13 @@ int SrsBandwidthClient::publish_checking(int duration_ms, int play_kbps) | ||
321 | 319 | ||
322 | // use the play kbps to control the publish | 320 | // use the play kbps to control the publish |
323 | srs_update_system_time_ms(); | 321 | srs_update_system_time_ms(); |
324 | - int elaps = srs_get_system_time_ms() - starttime; | 322 | + int elaps = (int)(srs_get_system_time_ms() - starttime); |
325 | if (elaps > 0) { | 323 | if (elaps > 0) { |
326 | - int current_kbps = _rtmp->get_send_bytes() * 8 / elaps; | 324 | + int current_kbps = (int)(_rtmp->get_send_bytes() * 8 / elaps); |
327 | while (current_kbps > play_kbps) { | 325 | while (current_kbps > play_kbps) { |
328 | srs_update_system_time_ms(); | 326 | srs_update_system_time_ms(); |
329 | - elaps = srs_get_system_time_ms() - starttime; | ||
330 | - current_kbps = _rtmp->get_send_bytes() * 8 / elaps; | 327 | + elaps = (int)(srs_get_system_time_ms() - starttime); |
328 | + current_kbps = (int)(_rtmp->get_send_bytes() * 8 / elaps); | ||
331 | usleep(100 * 1000); // TODO: FIXME: magic number. | 329 | usleep(100 * 1000); // TODO: FIXME: magic number. |
332 | } | 330 | } |
333 | } | 331 | } |
@@ -25,13 +25,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -25,13 +25,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | 25 | ||
26 | #include <srs_kernel_error.hpp> | 26 | #include <srs_kernel_error.hpp> |
27 | 27 | ||
28 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
29 | +#ifndef _WIN32 | ||
28 | #include <unistd.h> | 30 | #include <unistd.h> |
29 | -#include <sys/types.h> | ||
30 | #include <sys/socket.h> | 31 | #include <sys/socket.h> |
31 | #include <netinet/in.h> | 32 | #include <netinet/in.h> |
32 | #include <arpa/inet.h> | 33 | #include <arpa/inet.h> |
33 | -#include <errno.h> | ||
34 | #include <sys/uio.h> | 34 | #include <sys/uio.h> |
35 | +#endif | ||
36 | + | ||
37 | +#include <sys/types.h> | ||
38 | +#include <errno.h> | ||
35 | 39 | ||
36 | #include <srs_kernel_utility.hpp> | 40 | #include <srs_kernel_utility.hpp> |
37 | 41 | ||
@@ -82,7 +86,7 @@ int SimpleSocketStream::read(void* buf, size_t size, ssize_t* nread) | @@ -82,7 +86,7 @@ int SimpleSocketStream::read(void* buf, size_t size, ssize_t* nread) | ||
82 | { | 86 | { |
83 | int ret = ERROR_SUCCESS; | 87 | int ret = ERROR_SUCCESS; |
84 | 88 | ||
85 | - ssize_t nb_read = ::recv(fd, buf, size, 0); | 89 | + ssize_t nb_read = ::recv(fd, (char*)buf, size, 0); |
86 | 90 | ||
87 | if (nread) { | 91 | if (nread) { |
88 | *nread = nb_read; | 92 | *nread = nb_read; |
@@ -188,7 +192,7 @@ int SimpleSocketStream::read_fully(void* buf, size_t size, ssize_t* nread) | @@ -188,7 +192,7 @@ int SimpleSocketStream::read_fully(void* buf, size_t size, ssize_t* nread) | ||
188 | } | 192 | } |
189 | 193 | ||
190 | nb_read += this_nread; | 194 | nb_read += this_nread; |
191 | - left -= this_nread; | 195 | + left -= (size_t)this_nread; |
192 | } | 196 | } |
193 | 197 | ||
194 | if (nread) { | 198 | if (nread) { |
@@ -203,7 +207,7 @@ int SimpleSocketStream::write(void* buf, size_t size, ssize_t* nwrite) | @@ -203,7 +207,7 @@ int SimpleSocketStream::write(void* buf, size_t size, ssize_t* nwrite) | ||
203 | { | 207 | { |
204 | int ret = ERROR_SUCCESS; | 208 | int ret = ERROR_SUCCESS; |
205 | 209 | ||
206 | - ssize_t nb_write = ::send(fd, (void*)buf, size, 0); | 210 | + ssize_t nb_write = ::send(fd, (char*)buf, size, 0); |
207 | 211 | ||
208 | if (nwrite) { | 212 | if (nwrite) { |
209 | *nwrite = nb_write; | 213 | *nwrite = nb_write; |
@@ -24,7 +24,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -24,7 +24,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | #include <srs_librtmp.hpp> | 24 | #include <srs_librtmp.hpp> |
25 | 25 | ||
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | + | ||
28 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
29 | +#ifndef _WIN32 | ||
27 | #include <sys/time.h> | 30 | #include <sys/time.h> |
31 | +#endif | ||
28 | 32 | ||
29 | #include <string> | 33 | #include <string> |
30 | #include <sstream> | 34 | #include <sstream> |
@@ -98,6 +102,356 @@ struct Context | @@ -98,6 +102,356 @@ struct Context | ||
98 | } | 102 | } |
99 | }; | 103 | }; |
100 | 104 | ||
105 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
106 | +#ifdef _WIN32 | ||
107 | + int gettimeofday(struct timeval* tv, struct timezone* tz) | ||
108 | + { | ||
109 | + time_t clock; | ||
110 | + struct tm tm; | ||
111 | + SYSTEMTIME win_time; | ||
112 | + | ||
113 | + GetLocalTime(&win_time); | ||
114 | + | ||
115 | + tm.tm_year = win_time.wYear - 1900; | ||
116 | + tm.tm_mon = win_time.wMonth - 1; | ||
117 | + tm.tm_mday = win_time.wDay; | ||
118 | + tm.tm_hour = win_time.wHour; | ||
119 | + tm.tm_min = win_time.wMinute; | ||
120 | + tm.tm_sec = win_time.wSecond; | ||
121 | + tm.tm_isdst = -1; | ||
122 | + | ||
123 | + clock = mktime(&tm); | ||
124 | + | ||
125 | + tv->tv_sec = (long)clock; | ||
126 | + tv->tv_usec = win_time.wMilliseconds * 1000; | ||
127 | + | ||
128 | + return 0; | ||
129 | + } | ||
130 | + | ||
131 | + int open(const char *pathname, int flags) | ||
132 | + { | ||
133 | + return open(pathname, flags, 0); | ||
134 | + } | ||
135 | + | ||
136 | + int open(const char *pathname, int flags, mode_t mode) | ||
137 | + { | ||
138 | + FILE* file = NULL; | ||
139 | + | ||
140 | + if ((flags & O_RDONLY) == O_RDONLY) { | ||
141 | + file = fopen(pathname, "r"); | ||
142 | + } else { | ||
143 | + file = fopen(pathname, "w+"); | ||
144 | + } | ||
145 | + | ||
146 | + if (file == NULL) { | ||
147 | + return -1; | ||
148 | + } | ||
149 | + | ||
150 | + return (int)file; | ||
151 | + } | ||
152 | + | ||
153 | + int close(int fd) | ||
154 | + { | ||
155 | + FILE* file = (FILE*)fd; | ||
156 | + return fclose(file); | ||
157 | + } | ||
158 | + | ||
159 | + off_t lseek(int fd, off_t offset, int whence) | ||
160 | + { | ||
161 | + return (off_t)fseek((FILE*)fd, offset, whence); | ||
162 | + } | ||
163 | + | ||
164 | + ssize_t write(int fd, const void *buf, size_t count) | ||
165 | + { | ||
166 | + return (ssize_t)fwrite(buf, count, 1, (FILE*)fd); | ||
167 | + } | ||
168 | + | ||
169 | + ssize_t read(int fd, void *buf, size_t count) | ||
170 | + { | ||
171 | + return (ssize_t)fread(buf, count, 1, (FILE*)fd); | ||
172 | + } | ||
173 | + | ||
174 | + pid_t getpid(void) | ||
175 | + { | ||
176 | + return (pid_t)GetCurrentProcessId(); | ||
177 | + } | ||
178 | + | ||
179 | + int usleep(useconds_t usec) | ||
180 | + { | ||
181 | + Sleep((DWORD)(usec / 1000)); | ||
182 | + return 0; | ||
183 | + } | ||
184 | + | ||
185 | + ssize_t writev(int fd, const struct iovec *iov, int iovcnt) | ||
186 | + { | ||
187 | + ssize_t nwrite = 0; | ||
188 | + for (int i = 0; i < iovcnt; i++) { | ||
189 | + const struct iovec* current = iov + i; | ||
190 | + | ||
191 | + int nsent = ::send(fd, (char*)current->iov_base, current->iov_len, 0); | ||
192 | + if (nsent < 0) { | ||
193 | + return nsent; | ||
194 | + } | ||
195 | + | ||
196 | + nwrite += nsent; | ||
197 | + if (nsent == 0) { | ||
198 | + return nwrite; | ||
199 | + } | ||
200 | + } | ||
201 | + return nwrite; | ||
202 | + } | ||
203 | + | ||
204 | + //////////////////////// strlcpy.c (modified) ////////////////////////// | ||
205 | + | ||
206 | + /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ | ||
207 | + | ||
208 | + /*- | ||
209 | + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | ||
210 | + * | ||
211 | + * Permission to use, copy, modify, and distribute this software for any | ||
212 | + * purpose with or without fee is hereby granted, provided that the above | ||
213 | + * copyright notice and this permission notice appear in all copies. | ||
214 | + * | ||
215 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
216 | + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
217 | + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
218 | + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
219 | + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
220 | + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
221 | + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
222 | + */ | ||
223 | + | ||
224 | + //#include <sys/cdefs.h> // **** | ||
225 | + //#include <cstddef> // **** | ||
226 | + // __FBSDID("$FreeBSD: stable/9/sys/libkern/strlcpy.c 243811 2012-12-03 18:08:44Z delphij $"); // **** | ||
227 | + | ||
228 | + // #include <sys/types.h> // **** | ||
229 | + // #include <sys/libkern.h> // **** | ||
230 | + | ||
231 | + /* | ||
232 | + * Copy src to string dst of size siz. At most siz-1 characters | ||
233 | + * will be copied. Always NUL terminates (unless siz == 0). | ||
234 | + * Returns strlen(src); if retval >= siz, truncation occurred. | ||
235 | + */ | ||
236 | + | ||
237 | + //#define __restrict // **** | ||
238 | + | ||
239 | + std::size_t strlcpy(char * __restrict dst, const char * __restrict src, size_t siz) | ||
240 | + { | ||
241 | + char *d = dst; | ||
242 | + const char *s = src; | ||
243 | + size_t n = siz; | ||
244 | + | ||
245 | + /* Copy as many bytes as will fit */ | ||
246 | + if (n != 0) { | ||
247 | + while (--n != 0) { | ||
248 | + if ((*d++ = *s++) == '\0') | ||
249 | + break; | ||
250 | + } | ||
251 | + } | ||
252 | + | ||
253 | + /* Not enough room in dst, add NUL and traverse rest of src */ | ||
254 | + if (n == 0) { | ||
255 | + if (siz != 0) | ||
256 | + *d = '\0'; /* NUL-terminate dst */ | ||
257 | + while (*s++) | ||
258 | + ; | ||
259 | + } | ||
260 | + | ||
261 | + return(s - src - 1); /* count does not include NUL */ | ||
262 | + } | ||
263 | + | ||
264 | + // http://www.cplusplus.com/forum/general/141779///////////////////////// inet_ntop.c (modified) ////////////////////////// | ||
265 | + /* | ||
266 | + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") | ||
267 | + * Copyright (c) 1996-1999 by Internet Software Consortium. | ||
268 | + * | ||
269 | + * Permission to use, copy, modify, and distribute this software for any | ||
270 | + * purpose with or without fee is hereby granted, provided that the above | ||
271 | + * copyright notice and this permission notice appear in all copies. | ||
272 | + * | ||
273 | + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES | ||
274 | + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
275 | + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR | ||
276 | + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
277 | + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
278 | + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | ||
279 | + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
280 | + */ | ||
281 | + | ||
282 | + // #if defined(LIBC_SCCS) && !defined(lint) // **** | ||
283 | + //static const char rcsid[] = "$Id: inet_ntop.c,v 1.3.18.2 2005/11/03 23:02:22 marka Exp $"; | ||
284 | + // #endif /* LIBC_SCCS and not lint */ // **** | ||
285 | + // #include <sys/cdefs.h> // **** | ||
286 | + // __FBSDID("$FreeBSD: stable/9/sys/libkern/inet_ntop.c 213103 2010-09-24 15:01:45Z attilio $"); // **** | ||
287 | + | ||
288 | + //#define _WIN32_WINNT _WIN32_WINNT_WIN8 // **** | ||
289 | + //#include <Ws2tcpip.h> // **** | ||
290 | + #pragma comment(lib, "Ws2_32.lib") // **** | ||
291 | + //#include <cstdio> // **** | ||
292 | + | ||
293 | + // #include <sys/param.h> // **** | ||
294 | + // #include <sys/socket.h> // **** | ||
295 | + // #include <sys/systm.h> // **** | ||
296 | + | ||
297 | + // #include <netinet/in.h> // **** | ||
298 | + | ||
299 | + /*% | ||
300 | + * WARNING: Don't even consider trying to compile this on a system where | ||
301 | + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. | ||
302 | + */ | ||
303 | + | ||
304 | + static char *inet_ntop4(const u_char *src, char *dst, socklen_t size); | ||
305 | + static char *inet_ntop6(const u_char *src, char *dst, socklen_t size); | ||
306 | + | ||
307 | + /* char * | ||
308 | + * inet_ntop(af, src, dst, size) | ||
309 | + * convert a network format address to presentation format. | ||
310 | + * return: | ||
311 | + * pointer to presentation format address (`dst'), or NULL (see errno). | ||
312 | + * author: | ||
313 | + * Paul Vixie, 1996. | ||
314 | + */ | ||
315 | + const char* inet_ntop(int af, const void *src, char *dst, socklen_t size) | ||
316 | + { | ||
317 | + switch (af) { | ||
318 | + case AF_INET: | ||
319 | + return (inet_ntop4( (unsigned char*)src, (char*)dst, size)); // **** | ||
320 | + #ifdef AF_INET6 | ||
321 | + #error "IPv6 not supported" | ||
322 | + //case AF_INET6: | ||
323 | + // return (char*)(inet_ntop6( (unsigned char*)src, (char*)dst, size)); // **** | ||
324 | + #endif | ||
325 | + default: | ||
326 | + // return (NULL); // **** | ||
327 | + return 0 ; // **** | ||
328 | + } | ||
329 | + /* NOTREACHED */ | ||
330 | + } | ||
331 | + | ||
332 | + /* const char * | ||
333 | + * inet_ntop4(src, dst, size) | ||
334 | + * format an IPv4 address | ||
335 | + * return: | ||
336 | + * `dst' (as a const) | ||
337 | + * notes: | ||
338 | + * (1) uses no statics | ||
339 | + * (2) takes a u_char* not an in_addr as input | ||
340 | + * author: | ||
341 | + * Paul Vixie, 1996. | ||
342 | + */ | ||
343 | + static char * inet_ntop4(const u_char *src, char *dst, socklen_t size) | ||
344 | + { | ||
345 | + static const char fmt[128] = "%u.%u.%u.%u"; | ||
346 | + char tmp[sizeof "255.255.255.255"]; | ||
347 | + int l; | ||
348 | + | ||
349 | + l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); // **** | ||
350 | + if (l <= 0 || (socklen_t) l >= size) { | ||
351 | + return (NULL); | ||
352 | + } | ||
353 | + strlcpy(dst, tmp, size); | ||
354 | + return (dst); | ||
355 | + } | ||
356 | + | ||
357 | + /* const char * | ||
358 | + * inet_ntop6(src, dst, size) | ||
359 | + * convert IPv6 binary address into presentation (printable) format | ||
360 | + * author: | ||
361 | + * Paul Vixie, 1996. | ||
362 | + */ | ||
363 | + static char * inet_ntop6(const u_char *src, char *dst, socklen_t size) | ||
364 | + { | ||
365 | + /* | ||
366 | + * Note that int32_t and int16_t need only be "at least" large enough | ||
367 | + * to contain a value of the specified size. On some systems, like | ||
368 | + * Crays, there is no such thing as an integer variable with 16 bits. | ||
369 | + * Keep this in mind if you think this function should have been coded | ||
370 | + * to use pointer overlays. All the world's not a VAX. | ||
371 | + */ | ||
372 | + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; | ||
373 | + struct { int base, len; } best, cur; | ||
374 | + #define NS_IN6ADDRSZ 16 | ||
375 | + #define NS_INT16SZ 2 | ||
376 | + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; | ||
377 | + int i; | ||
378 | + | ||
379 | + /* | ||
380 | + * Preprocess: | ||
381 | + * Copy the input (bytewise) array into a wordwise array. | ||
382 | + * Find the longest run of 0x00's in src[] for :: shorthanding. | ||
383 | + */ | ||
384 | + memset(words, '\0', sizeof words); | ||
385 | + for (i = 0; i < NS_IN6ADDRSZ; i++) | ||
386 | + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); | ||
387 | + best.base = -1; | ||
388 | + best.len = 0; | ||
389 | + cur.base = -1; | ||
390 | + cur.len = 0; | ||
391 | + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { | ||
392 | + if (words[i] == 0) { | ||
393 | + if (cur.base == -1) | ||
394 | + cur.base = i, cur.len = 1; | ||
395 | + else | ||
396 | + cur.len++; | ||
397 | + } else { | ||
398 | + if (cur.base != -1) { | ||
399 | + if (best.base == -1 || cur.len > best.len) | ||
400 | + best = cur; | ||
401 | + cur.base = -1; | ||
402 | + } | ||
403 | + } | ||
404 | + } | ||
405 | + if (cur.base != -1) { | ||
406 | + if (best.base == -1 || cur.len > best.len) | ||
407 | + best = cur; | ||
408 | + } | ||
409 | + if (best.base != -1 && best.len < 2) | ||
410 | + best.base = -1; | ||
411 | + | ||
412 | + /* | ||
413 | + * Format the result. | ||
414 | + */ | ||
415 | + tp = tmp; | ||
416 | + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { | ||
417 | + /* Are we inside the best run of 0x00's? */ | ||
418 | + if (best.base != -1 && i >= best.base && | ||
419 | + i < (best.base + best.len)) { | ||
420 | + if (i == best.base) | ||
421 | + *tp++ = ':'; | ||
422 | + continue; | ||
423 | + } | ||
424 | + /* Are we following an initial run of 0x00s or any real hex? */ | ||
425 | + if (i != 0) | ||
426 | + *tp++ = ':'; | ||
427 | + /* Is this address an encapsulated IPv4? */ | ||
428 | + if (i == 6 && best.base == 0 && (best.len == 6 || | ||
429 | + (best.len == 7 && words[7] != 0x0001) || | ||
430 | + (best.len == 5 && words[5] == 0xffff))) { | ||
431 | + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) | ||
432 | + return (NULL); | ||
433 | + tp += strlen(tp); | ||
434 | + break; | ||
435 | + } | ||
436 | + tp += std::sprintf(tp, "%x", words[i]); // **** | ||
437 | + } | ||
438 | + /* Was it a trailing run of 0x00's? */ | ||
439 | + if (best.base != -1 && (best.base + best.len) == | ||
440 | + (NS_IN6ADDRSZ / NS_INT16SZ)) | ||
441 | + *tp++ = ':'; | ||
442 | + *tp++ = '\0'; | ||
443 | + | ||
444 | + /* | ||
445 | + * Check for overflow, copy, and we're done. | ||
446 | + */ | ||
447 | + if ((socklen_t)(tp - tmp) > size) { | ||
448 | + return (NULL); | ||
449 | + } | ||
450 | + strcpy(dst, tmp); | ||
451 | + return (dst); | ||
452 | + } | ||
453 | +#endif | ||
454 | + | ||
101 | int srs_librtmp_context_parse_uri(Context* context) | 455 | int srs_librtmp_context_parse_uri(Context* context) |
102 | { | 456 | { |
103 | int ret = ERROR_SUCCESS; | 457 | int ret = ERROR_SUCCESS; |
@@ -596,7 +950,7 @@ const char* srs_format_time() | @@ -596,7 +950,7 @@ const char* srs_format_time() | ||
596 | 950 | ||
597 | // to calendar time | 951 | // to calendar time |
598 | struct tm* tm; | 952 | struct tm* tm; |
599 | - if ((tm = localtime(&tv.tv_sec)) == NULL) { | 953 | + if ((tm = localtime((const time_t*)&tv.tv_sec)) == NULL) { |
600 | return buf; | 954 | return buf; |
601 | } | 955 | } |
602 | 956 | ||
@@ -605,6 +959,9 @@ const char* srs_format_time() | @@ -605,6 +959,9 @@ const char* srs_format_time() | ||
605 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, | 959 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, |
606 | tm->tm_hour, tm->tm_min, tm->tm_sec, | 960 | tm->tm_hour, tm->tm_min, tm->tm_sec, |
607 | (int)(tv.tv_usec / 1000)); | 961 | (int)(tv.tv_usec / 1000)); |
962 | + | ||
963 | + // for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
964 | + buf[sizeof(buf) - 1] = 0; | ||
608 | 965 | ||
609 | return buf; | 966 | return buf; |
610 | } | 967 | } |
@@ -30,6 +30,48 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,6 +30,48 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
30 | 30 | ||
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | 32 | ||
33 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
34 | +#ifdef _WIN32 | ||
35 | + #define _CRT_SECURE_NO_WARNINGS | ||
36 | + typedef unsigned long long u_int64_t; | ||
37 | + typedef long long int64_t; | ||
38 | + typedef unsigned int u_int32_t; | ||
39 | + typedef int int32_t; | ||
40 | + typedef unsigned char u_int8_t; | ||
41 | + typedef char int8_t; | ||
42 | + typedef unsigned short u_int16_t; | ||
43 | + typedef short int16_t; | ||
44 | + typedef int64_t ssize_t; | ||
45 | + struct iovec { | ||
46 | + void *iov_base; /* Starting address */ | ||
47 | + size_t iov_len; /* Number of bytes to transfer */ | ||
48 | + }; | ||
49 | + #include <time.h> | ||
50 | + #include <windows.h> | ||
51 | + int gettimeofday(struct timeval* tv, struct timezone* tz); | ||
52 | + #define PRId64 "lld" | ||
53 | + typedef int socklen_t; | ||
54 | + const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); | ||
55 | + typedef int mode_t; | ||
56 | + #define S_IRUSR 0 | ||
57 | + #define S_IWUSR 0 | ||
58 | + #define S_IRGRP 0 | ||
59 | + #define S_IWGRP 0 | ||
60 | + #define S_IROTH 0 | ||
61 | + int open(const char *pathname, int flags); | ||
62 | + int open(const char *pathname, int flags, mode_t mode); | ||
63 | + int close(int fd); | ||
64 | + off_t lseek(int fd, off_t offset, int whence); | ||
65 | + ssize_t write(int fd, const void *buf, size_t count); | ||
66 | + ssize_t read(int fd, void *buf, size_t count); | ||
67 | + typedef int pid_t; | ||
68 | + pid_t getpid(void); | ||
69 | + #define snprintf _snprintf | ||
70 | + ssize_t writev(int fd, const struct iovec *iov, int iovcnt); | ||
71 | + typedef int64_t useconds_t; | ||
72 | + int usleep(useconds_t usec); | ||
73 | +#endif | ||
74 | + | ||
33 | /** | 75 | /** |
34 | * srs-librtmp is a librtmp like library, | 76 | * srs-librtmp is a librtmp like library, |
35 | * used to play/publish rtmp stream from/to rtmp server. | 77 | * used to play/publish rtmp stream from/to rtmp server. |
@@ -30,7 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,7 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
30 | 30 | ||
31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
32 | 32 | ||
33 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
34 | +#ifndef _WIN32 | ||
33 | #include <sys/uio.h> | 35 | #include <sys/uio.h> |
36 | +#endif | ||
34 | 37 | ||
35 | #include <srs_kernel_buffer.hpp> | 38 | #include <srs_kernel_buffer.hpp> |
36 | 39 |
@@ -31,7 +31,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
31 | #include <srs_kernel_stream.hpp> | 31 | #include <srs_kernel_stream.hpp> |
32 | #include <srs_kernel_utility.hpp> | 32 | #include <srs_kernel_utility.hpp> |
33 | 33 | ||
34 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
35 | +#ifndef _WIN32 | ||
34 | #include <unistd.h> | 36 | #include <unistd.h> |
37 | +#endif | ||
38 | + | ||
35 | using namespace std; | 39 | using namespace std; |
36 | 40 | ||
37 | /** | 41 | /** |
@@ -260,7 +264,7 @@ int SrsHandshakeBytes::create_c0c1() | @@ -260,7 +264,7 @@ int SrsHandshakeBytes::create_c0c1() | ||
260 | return ret; | 264 | return ret; |
261 | } | 265 | } |
262 | stream.write_1bytes(0x03); | 266 | stream.write_1bytes(0x03); |
263 | - stream.write_4bytes(::time(NULL)); | 267 | + stream.write_4bytes((int32_t)::time(NULL)); |
264 | stream.write_4bytes(0x00); | 268 | stream.write_4bytes(0x00); |
265 | 269 | ||
266 | return ret; | 270 | return ret; |
@@ -283,7 +287,7 @@ int SrsHandshakeBytes::create_s0s1s2(const char* c1) | @@ -283,7 +287,7 @@ int SrsHandshakeBytes::create_s0s1s2(const char* c1) | ||
283 | return ret; | 287 | return ret; |
284 | } | 288 | } |
285 | stream.write_1bytes(0x03); | 289 | stream.write_1bytes(0x03); |
286 | - stream.write_4bytes(::time(NULL)); | 290 | + stream.write_4bytes((int32_t)::time(NULL)); |
287 | // s2 time2 copy from c1 | 291 | // s2 time2 copy from c1 |
288 | if (c0c1) { | 292 | if (c0c1) { |
289 | stream.write_bytes(c0c1 + 1, 4); | 293 | stream.write_bytes(c0c1 + 1, 4); |
@@ -314,7 +318,7 @@ int SrsHandshakeBytes::create_c2() | @@ -314,7 +318,7 @@ int SrsHandshakeBytes::create_c2() | ||
314 | if ((ret = stream.initialize(c2, 8)) != ERROR_SUCCESS) { | 318 | if ((ret = stream.initialize(c2, 8)) != ERROR_SUCCESS) { |
315 | return ret; | 319 | return ret; |
316 | } | 320 | } |
317 | - stream.write_4bytes(::time(NULL)); | 321 | + stream.write_4bytes((int32_t)::time(NULL)); |
318 | // c2 time2 copy from s1 | 322 | // c2 time2 copy from s1 |
319 | if (s0s1s2) { | 323 | if (s0s1s2) { |
320 | stream.write_bytes(s0s1s2 + 1, 4); | 324 | stream.write_bytes(s0s1s2 + 1, 4); |
@@ -397,7 +397,8 @@ SrsMessage::~SrsMessage() | @@ -397,7 +397,8 @@ SrsMessage::~SrsMessage() | ||
397 | 397 | ||
398 | SrsProtocol::AckWindowSize::AckWindowSize() | 398 | SrsProtocol::AckWindowSize::AckWindowSize() |
399 | { | 399 | { |
400 | - ack_window_size = acked_size = 0; | 400 | + ack_window_size = 0; |
401 | + acked_size = 0; | ||
401 | } | 402 | } |
402 | 403 | ||
403 | SrsProtocol::SrsProtocol(ISrsProtocolReaderWriter* io) | 404 | SrsProtocol::SrsProtocol(ISrsProtocolReaderWriter* io) |
@@ -1427,7 +1428,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | @@ -1427,7 +1428,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz | ||
1427 | * @remark, srs always send the extended-timestamp, to keep simple, | 1428 | * @remark, srs always send the extended-timestamp, to keep simple, |
1428 | * and compatible with adobe products. | 1429 | * and compatible with adobe products. |
1429 | */ | 1430 | */ |
1430 | - u_int32_t chunk_timestamp = chunk->header.timestamp; | 1431 | + u_int32_t chunk_timestamp = (u_int32_t)chunk->header.timestamp; |
1431 | 1432 | ||
1432 | /** | 1433 | /** |
1433 | * if chunk_timestamp<=0, the chunk previous packet has no extended-timestamp, | 1434 | * if chunk_timestamp<=0, the chunk previous packet has no extended-timestamp, |
@@ -1695,7 +1696,8 @@ int SrsProtocol::response_acknowledgement_message() | @@ -1695,7 +1696,8 @@ int SrsProtocol::response_acknowledgement_message() | ||
1695 | int ret = ERROR_SUCCESS; | 1696 | int ret = ERROR_SUCCESS; |
1696 | 1697 | ||
1697 | SrsAcknowledgementPacket* pkt = new SrsAcknowledgementPacket(); | 1698 | SrsAcknowledgementPacket* pkt = new SrsAcknowledgementPacket(); |
1698 | - in_ack_size.acked_size = pkt->sequence_number = skt->get_recv_bytes(); | 1699 | + in_ack_size.acked_size = skt->get_recv_bytes(); |
1700 | + pkt->sequence_number = (int32_t)in_ack_size.acked_size; | ||
1699 | if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { | 1701 | if ((ret = send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) { |
1700 | srs_error("send acknowledgement failed. ret=%d", ret); | 1702 | srs_error("send acknowledgement failed. ret=%d", ret); |
1701 | return ret; | 1703 | return ret; |
@@ -32,7 +32,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -32,7 +32,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
32 | 32 | ||
33 | #include <map> | 33 | #include <map> |
34 | #include <string> | 34 | #include <string> |
35 | + | ||
36 | +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 | ||
37 | +#ifndef _WIN32 | ||
35 | #include <sys/uio.h> | 38 | #include <sys/uio.h> |
39 | +#endif | ||
36 | 40 | ||
37 | #include <srs_kernel_log.hpp> | 41 | #include <srs_kernel_log.hpp> |
38 | #include <srs_kernel_error.hpp> | 42 | #include <srs_kernel_error.hpp> |
-
请 注册 或 登录 后发表评论