History

Replace usleep() calls with av_usleep()

This reduces the dependency on unistd.h which is not available on all systems.

Mans Rullgard committed 14 years ago

Commit 896bb0d1 parent d3d3a328 files · +18 −19Browse files

Showing the changes to libavformat (4 of 8 files). Show all

Unified · Split

4 files
  1. libavformat/avio.c +2 −3
  2. libavformat/hls.c +2 −2
  3. libavformat/hlsproto.c +2 −2
  4. libavformat/rtmphttp.c +2 −3
libavformat/avio.c+2−3
@@ -19,11 +19,10 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22−#include <unistd.h>
23−
2422 #include "libavutil/avstring.h"
2523 #include "libavutil/dict.h"
2624 #include "libavutil/opt.h"
25+#include "libavutil/time.h"
2726 #include "os_support.h"
2827 #include "avformat.h"
2928 #if CONFIG_NETWORK
@@ -237,7 +236,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int · 207 unmodified lines
237236 if (fast_retries)
238237 fast_retries--;
239238 else
240− usleep(1000);
239+ av_usleep(1000);
241240 } else if (ret < 1)
242241 return ret < 0 ? ret : len;
243242 if (ret)
libavformat/hls.c+2−2
@@ -30,9 +30,9 @@ · 29 unmodified lines
3030 #include "libavutil/mathematics.h"
3131 #include "libavutil/opt.h"
3232 #include "libavutil/dict.h"
33+#include "libavutil/time.h"
3334 #include "avformat.h"
3435 #include "internal.h"
35−#include <unistd.h>
3636 #include "avio_internal.h"
3737 #include "url.h"
3838
@@ -407,7 +407,7 @@ reload: · 368 unmodified lines
407407 while (av_gettime() - v->last_load_time < reload_interval) {
408408 if (ff_check_interrupt(c->interrupt_callback))
409409 return AVERROR_EXIT;
410− usleep(100*1000);
410+ av_usleep(100*1000);
411411 }
412412 /* Enough time has elapsed since the last reload */
413413 goto reload;
libavformat/hlsproto.c+2−2
@@ -26,11 +26,11 @@ · 25 unmodified lines
2626 */
2727
2828 #include "libavutil/avstring.h"
29+#include "libavutil/time.h"
2930 #include "avformat.h"
3031 #include "internal.h"
3132 #include "url.h"
3233 #include "version.h"
33−#include <unistd.h>
3434
3535 /*
3636 * An apple http stream consists of a playlist with media segment files,
@@ -308,7 +308,7 @@ retry: · 271 unmodified lines
308308 while (av_gettime() - s->last_load_time < reload_interval) {
309309 if (ff_check_interrupt(&h->interrupt_callback))
310310 return AVERROR_EXIT;
311− usleep(100*1000);
311+ av_usleep(100*1000);
312312 }
313313 goto retry;
314314 }
libavformat/rtmphttp.c+2−3
@@ -24,11 +24,10 @@ · 23 unmodified lines
2424 * RTMP HTTP protocol
2525 */
2626
27−#include <unistd.h>
28−
2927 #include "libavutil/avstring.h"
3028 #include "libavutil/intfloat.h"
3129 #include "libavutil/opt.h"
30+#include "libavutil/time.h"
3231 #include "internal.h"
3332 #include "http.h"
3433
@@ -126,7 +125,7 @@ static int rtmp_http_read(URLContext *h, uint8_t *buf, int size) · 91 unmodified lines
126125 if (rt->nb_bytes_read == 0) {
127126 /* Wait 50ms before retrying to read a server reply in
128127 * order to reduce the number of idle requets. */
129− usleep(50000);
128+ av_usleep(50000);
130129 }
131130
132131 if ((ret = rtmp_http_write(h, "", 1)) < 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t