Skip to content

Commit e7e7f6b

Browse files
committed
change: system_clock uint64 -> uint32
1 parent 5e5dc13 commit e7e7f6b

15 files changed

+31
-31
lines changed

libdash/test/dash-dynamic-test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int dash_live_worker(const char* file, dash_playlist_t* dash)
128128
uint32_t timestamp;
129129
uint32_t s_timestamp = 0;
130130
uint32_t diff = 0;
131-
uint64_t clock;
131+
uint32_t clock;
132132

133133
while (1)
134134
{
@@ -137,7 +137,7 @@ static int dash_live_worker(const char* file, dash_playlist_t* dash)
137137
clock = system_clock(); // timestamp start from 0
138138
while (1 == flv_reader_read(f, &type, &timestamp, &taglen, dash->packet, sizeof(dash->packet)))
139139
{
140-
uint64_t t = system_clock();
140+
uint32_t t = system_clock();
141141
if (clock + timestamp > t && clock + timestamp < t + 3 * 1000)
142142
system_sleep(clock + timestamp - t);
143143
else if (clock + timestamp > t + 3 * 1000)

libhls/demo/hls-server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int STDCALL hls_server_worker(void* param)
121121
{
122122
int r, type;
123123
size_t taglen;
124-
uint64_t clock;
124+
uint32_t clock;
125125
uint32_t timestamp;
126126
hls_playlist_t* playlist = (hls_playlist_t*)param;
127127

@@ -138,7 +138,7 @@ static int STDCALL hls_server_worker(void* param)
138138
clock = 0;
139139
while (1 == flv_reader_read(flv, &type, &timestamp, &taglen, playlist->packet, sizeof(playlist->packet)))
140140
{
141-
uint64_t now = system_clock();
141+
uint32_t now = system_clock();
142142
if (0 == clock)
143143
{
144144
clock = now;

librtmp/test/rtmp-play-aio-test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void rtmp_play_aio_test(const char* host, const char* app, const char* stream, c
6464
void* flv = flv_writer_create(file);
6565
aio_connect(host, 1935, 3000, rtmp_onconnect, flv);
6666

67-
// uint64_t clock = system_clock();
67+
// uint32_t clock = system_clock();
6868
while (0 == s_param.code)
6969
{
7070
aio_socket_process(1000);

librtmp/test/rtmp-publish-aio-test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ static int STDCALL rtmp_client_push(void* flv)
2626
int r, type;
2727
size_t taglen;
2828
uint32_t timestamp;
29-
uint64_t clock0 = system_clock();
29+
uint32_t clock0 = system_clock();
3030
void* f = flv_reader_create((const char*)flv);
3131

3232
static char packet[2 * 1024 * 1024];
3333
while (0 == s_param.code && 1 == flv_reader_read(f, &type, &timestamp, &taglen, packet, sizeof(packet)))
3434
{
35-
uint64_t t = system_clock();
35+
uint32_t t = system_clock();
3636
if(clock0 + timestamp > t && clock0 + timestamp < t + 3 * 1000)
3737
system_sleep(clock0 + timestamp - t);
3838
else if (t + timestamp > t + 3 * 1000)

librtmp/test/rtmp-publish-test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static void rtmp_client_push(const char* flv, rtmp_client_t* rtmp)
8888
uint32_t timestamp;
8989
uint32_t s_timestamp = 0;
9090
uint32_t diff = 0;
91-
uint64_t clock;
91+
uint32_t clock;
9292

9393
static char packet[2 * 1024 * 1024];
9494
while (1)
@@ -98,7 +98,7 @@ static void rtmp_client_push(const char* flv, rtmp_client_t* rtmp)
9898
clock = system_clock(); // timestamp start from 0
9999
while (1 == flv_reader_read(f, &type, &timestamp, &taglen, packet, sizeof(packet)))
100100
{
101-
uint64_t t = system_clock();
101+
uint32_t t = system_clock();
102102
if (clock + timestamp > t && clock + timestamp < t + 3 * 1000) // dts skip
103103
system_sleep(clock + timestamp - t);
104104
else if (clock + timestamp > t + 3 * 1000)

librtmp/test/rtmp-server-publish-benchmark.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct rtmp_raw_packet_t
2222
uint32_t timestamp;
2323
};
2424

25-
static uint64_t s_clock;
25+
static uint32_t s_clock;
2626
static std::vector<rtmp_raw_packet_t> s_pkts;
2727
static rtmp_server_publish_benchmark_t s_servers[N];
2828

@@ -51,15 +51,15 @@ static void init_packets(const char* filename)
5151
}
5252
}
5353

54-
static void rtmp_server_publish_input(rtmp_server_publish_benchmark_t* rtmp, uint64_t now)
54+
static void rtmp_server_publish_input(rtmp_server_publish_benchmark_t* rtmp, uint32_t now)
5555
{
5656
if (rtmp->i >= s_pkts.size())
5757
return;
5858

5959
for(int i = 0; 1; i++)
6060
{
6161
rtmp_raw_packet_t& pkt = s_pkts[rtmp->i];
62-
if (s_clock + pkt.timestamp > now)
62+
if ((int)(s_clock + pkt.timestamp - now) > 0)
6363
{
6464
if (i > 50) printf("cycle %d\n", i);
6565
return;
@@ -75,7 +75,7 @@ static int STDCALL rtmp_server_onthread(void* param)
7575
int idx = (int)(intptr_t)param;
7676
while (1)
7777
{
78-
uint64_t now = system_clock();
78+
uint32_t now = system_clock();
7979
for (int i = idx; i < N; i += M)
8080
{
8181
rtmp_server_publish_input(s_servers + i, now);

librtmp/test/rtmp-server-vod-aio-test.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ static int STDCALL aio_rtmp_server_worker(void* param)
2828
uint32_t timestamp;
2929
uint32_t s_timestamp = 0;
3030
uint32_t diff = 0;
31-
uint64_t clock;
32-
//uint64_t clock0 = system_clock() - 3000; // send more data, open fast
31+
uint32_t clock;
32+
//uint32_t clock0 = system_clock() - 3000; // send more data, open fast
3333
rtmp_server_vod_t* vod = (rtmp_server_vod_t*)param;
3434

3535
while (1)
@@ -40,7 +40,7 @@ static int STDCALL aio_rtmp_server_worker(void* param)
4040
while (1 == flv_reader_read(f, &type, &timestamp, &taglen, vod->packet, sizeof(vod->packet)))
4141
{
4242
assert(taglen < sizeof(vod->packet));
43-
uint64_t t = system_clock();
43+
uint32_t t = system_clock();
4444
if (clock + timestamp > t && clock + timestamp < t + 3 * 1000)
4545
system_sleep(clock + timestamp - t);
4646
else if (clock + timestamp > t + 3 * 1000)

librtmp/test/rtmp-server-vod-test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ static int STDCALL rtmp_server_worker(void* param)
1616
int r, type;
1717
size_t taglen;
1818
uint32_t timestamp;
19-
static uint64_t clock0 = system_clock() - 200; // send more data, open fast
19+
static uint32_t clock0 = system_clock() - 200; // send more data, open fast
2020
void* f = flv_reader_create(s_file);
2121

2222
static unsigned char packet[8 * 1024 * 1024];
2323
while (1 == flv_reader_read(f, &type, &timestamp, &taglen, packet, sizeof(packet)))
2424
{
2525
assert(taglen < sizeof(packet));
26-
uint64_t t = system_clock();
26+
uint32_t t = system_clock();
2727
if (clock0 + timestamp > t && clock0 + timestamp < t + 3 * 1000)
2828
system_sleep(clock0 + timestamp - t);
2929
else if (clock0 + timestamp > t + 3 * 1000)

librtp/test/rtp-dump-replay.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void rtp_dump_replay_test(const char* file, const char* peer, int port)
1111
int r;
1212
uint8_t data[1500];
1313
uint32_t clock, clock0;
14-
uint64_t base = 0;
14+
uint32_t base = 0;
1515
struct rtpdump_t* dump;
1616

1717
socket_init();
@@ -29,7 +29,7 @@ void rtp_dump_replay_test(const char* file, const char* peer, int port)
2929
break;
3030

3131
assert(r >= 0);
32-
uint64_t now = system_clock();
32+
uint32_t now = system_clock();
3333
if (0 == base)
3434
{
3535
base = now;
@@ -39,7 +39,7 @@ void rtp_dump_replay_test(const char* file, const char* peer, int port)
3939
{
4040
if (now - base < clock - clock0)
4141
{
42-
uint64_t v = (uint64_t)(clock - clock0) - (now - base);
42+
uint32_t v = (uint64_t)(clock - clock0) - (now - base);
4343
if(v < 5000)
4444
system_sleep(v);
4545
}

librtsp/test/media/ffmpeg-file-source.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ int FFFileSource::Play()
211211
}
212212

213213
m_status = 1;
214-
uint64_t clock = system_clock();
214+
uint64_t clock = system_time();
215215
for (int i = 0; i < m_count; i++)
216216
{
217217
struct media_t* m = &m_media[i];
@@ -289,7 +289,7 @@ int FFFileSource::Seek(int64_t pos)
289289
if (-1 != m_media[i].dts_first)
290290
m_media[i].timestamp += m_media[i].dts_last - m_media[i].dts_first + 1;
291291
m_media[i].dts_first = -1;
292-
//SendRTCP(&m_media[i], system_clock());
292+
//SendRTCP(&m_media[i], system_time());
293293
}
294294

295295
m_dts = -1;
@@ -543,7 +543,7 @@ int FFFileSource::RTPPacket(void* param, const void *packet, int bytes, uint32_t
543543
// Hack: Send an initial RTCP "SR" packet, before the initial RTP packet,
544544
// so that receivers will (likely) be able to get RTCP-synchronized presentation times immediately:
545545
rtp_onsend(m->rtp, packet, bytes/*, time*/);
546-
SendRTCP(m, system_clock());
546+
SendRTCP(m, system_time());
547547

548548
int r = m->transport->Send(false, packet, bytes);
549549
assert(r == (int)bytes);

librtsp/test/media/ffmpeg-live-source.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ int FFLiveSource::Play()
369369
}
370370

371371
m_status = 1;
372-
uint64_t clock = system_clock();
372+
uint64_t clock = system_time();
373373
for (int i = 0; i < m_count; i++)
374374
{
375375
struct media_t* m = &m_media[i];
@@ -750,7 +750,7 @@ int FFLiveSource::RTPPacket(void* param, const void *packet, int bytes, uint32_t
750750
// Hack: Send an initial RTCP "SR" packet, before the initial RTP packet,
751751
// so that receivers will (likely) be able to get RTCP-synchronized presentation times immediately:
752752
rtp_onsend(m->rtp, packet, bytes/*, time*/);
753-
SendRTCP(m, system_clock());
753+
SendRTCP(m, system_time());
754754

755755
int r = m->transport->Send(false, packet, bytes);
756756
assert(r == (int)bytes);

librtsp/test/media/mp4-file-source.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int MP4FileSource::Play()
128128

129129
m_status = 1;
130130
int bytes = 0;
131-
uint64_t clock = system_clock();
131+
uint64_t clock = system_time();
132132
std::shared_ptr<struct avpacket_t> pkt(avpacket_queue_front(m->pkts), avpacket_release);
133133
int64_t dts = pkt->dts < pkt->pts ? pkt->dts : pkt->pts;
134134

librtsp/test/media/vod-file-source.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int VodFileSource::Worker()
4646
r = 0; // 1 -> 0
4747
}
4848

49-
uint64_t now = system_clock();
49+
uint64_t now = system_time();
5050
uint64_t timestamp = 0 == pkt->dts || -1 == pkt->dts ? pkt->pts : pkt->dts;
5151

5252
if (0 == m_clock || now < m_clock || timestamp < m_timestamp)

librtsp/test/rtp-streaming-test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct rtp_streaming_test_stream_t
5050
struct rtp_streaming_test_t
5151
{
5252
struct rtp_streaming_test_stream_t a, v;
53-
uint64_t clock;
53+
uint32_t clock;
5454
};
5555

5656
static int rtp_encode_packet(void* param, int pid, const void* packet, int bytes, uint32_t timestamp, int /*flags*/)
@@ -82,7 +82,7 @@ static void onread(void* param, uint32_t track, const void* buffer, size_t bytes
8282
static int64_t a_pts, a_dts;
8383
struct rtp_streaming_test_t* ctx = (struct rtp_streaming_test_t*)param;
8484

85-
uint64_t clock = system_clock();
85+
uint32_t clock = system_clock();
8686
if (clock - ctx->clock + 5 < dts)
8787
system_sleep(dts - (clock - ctx->clock + 5));
8888

librtsp/test/rtsp-server-test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static int rtsp_onplay(void* /*ptr*/, rtsp_server_t* rtsp, const char* uri, cons
411411
// for vlc 2.2.2
412412
MP4FileSource* mp4 = dynamic_cast<MP4FileSource*>(source.get());
413413
if(mp4)
414-
mp4->SendRTCP(system_clock());
414+
mp4->SendRTCP(system_time());
415415

416416
it->second.status = 1;
417417
return rtsp_server_reply_play(rtsp, 200, npt, NULL, rtpinfo);

0 commit comments

Comments
 (0)