History

use a function to convert timestamps

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit e3323ce1 parent adf32271 file · +11 −2Browse files

Unified · Split

main.c+11−2
@@ -22,6 +22,15 @@ usage(void) · 21 unmodified lines
22 threadexitsall("usage");22 threadexitsall("usage");
23}23}
24 24
25static uvlong
26ns2ms(uvlong z, uvlong ns)
27{
28 if(z != 0 && z != Zns₀)
29 ns = z - ns₀ + ns;
30
31 return ns / 1000000ULL;
32}
33
25static void34static void
26audio(void *aux)35audio(void *aux)
27{36{
@@ -37,7 +46,7 @@ audio(void *aux) · 9 unmodified lines
37 goto err;46 goto err;
38 if(af.sz == 0) /* eof */47 if(af.sz == 0) /* eof */
39 break;48 break;
40 ms = ((af.ns₀ != Zns₀ ? af.ns₀-ns₀ : 0) + af.ns)/1000000ULL;49 ms = ns2ms(af.ns₀, af.ns);
41 50
42 if(rtmpdata(r, sid, ms, Taudio, af.buf, af.sz) != 0){51 if(rtmpdata(r, sid, ms, Taudio, af.buf, af.sz) != 0){
43err:52err:
@@ -103,7 +112,7 @@ threadmain(int argc, char **argv) · 59 unmodified lines
103 sysfatal("%r");112 sysfatal("%r");
104 if(vf.sz == 0)113 if(vf.sz == 0)
105 break;114 break;
106 ms = ((ivf.ns₀ != Zns₀ ? ivf.ns₀-ns₀ : 0) + vf.ns)/1000000ULL;115 ms = ns2ms(ivf.ns₀, vf.ns);
107 if(rtmpdata(r, sid, ms, Tvideo, vf.buf, vf.sz) != 0){116 if(rtmpdata(r, sid, ms, Tvideo, vf.buf, vf.sz) != 0){
108 fprint(2, "%r\n");117 fprint(2, "%r\n");
109 break;118 break;

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