Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ab962722
Commit
ab962722
authored
Jan 16, 2020
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "avformat/utils: make ff_ntp_time() accept a timestamp as input argument"
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
80c3a15a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
10 deletions
+11
-10
internal.h
libavformat/internal.h
+1
-1
movenc.c
libavformat/movenc.c
+4
-2
rtpenc.c
libavformat/rtpenc.c
+4
-4
rtpenc.h
libavformat/rtpenc.h
+0
-1
utils.c
libavformat/utils.c
+2
-2
No files found.
libavformat/internal.h
View file @
ab962722
...
@@ -243,7 +243,7 @@ void ff_read_frame_flush(AVFormatContext *s);
...
@@ -243,7 +243,7 @@ void ff_read_frame_flush(AVFormatContext *s);
#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
/** Get the current time since NTP epoch in microseconds. */
/** Get the current time since NTP epoch in microseconds. */
uint64_t
ff_ntp_time
(
int64_t
timestamp
);
uint64_t
ff_ntp_time
(
void
);
/**
/**
* Get the NTP time stamp formatted as per the RFC-5905.
* Get the NTP time stamp formatted as per the RFC-5905.
...
...
libavformat/movenc.c
View file @
ab962722
...
@@ -4657,10 +4657,12 @@ static int mov_write_prft_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks)
...
@@ -4657,10 +4657,12 @@ static int mov_write_prft_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks)
if
(
mov
->
write_prft
==
MOV_PRFT_SRC_WALLCLOCK
)
{
if
(
mov
->
write_prft
==
MOV_PRFT_SRC_WALLCLOCK
)
{
if
(
first_track
->
cluster
[
0
].
prft
.
wallclock
)
{
if
(
first_track
->
cluster
[
0
].
prft
.
wallclock
)
{
ntp_ts
=
ff_get_formatted_ntp_time
(
ff_ntp_time
(
first_track
->
cluster
[
0
].
prft
.
wallclock
));
/* Round the NTP time to whole milliseconds. */
ntp_ts
=
ff_get_formatted_ntp_time
((
first_track
->
cluster
[
0
].
prft
.
wallclock
/
1000
)
*
1000
+
NTP_OFFSET_US
);
flags
=
first_track
->
cluster
[
0
].
prft
.
flags
;
flags
=
first_track
->
cluster
[
0
].
prft
.
flags
;
}
else
}
else
ntp_ts
=
ff_get_formatted_ntp_time
(
ff_ntp_time
(
av_gettime
()
));
ntp_ts
=
ff_get_formatted_ntp_time
(
ff_ntp_time
());
}
else
if
(
mov
->
write_prft
==
MOV_PRFT_SRC_PTS
)
{
}
else
if
(
mov
->
write_prft
==
MOV_PRFT_SRC_PTS
)
{
pts_us
=
av_rescale_q
(
first_track
->
cluster
[
0
].
pts
,
pts_us
=
av_rescale_q
(
first_track
->
cluster
[
0
].
pts
,
first_track
->
st
->
time_base
,
AV_TIME_BASE_Q
);
first_track
->
st
->
time_base
,
AV_TIME_BASE_Q
);
...
...
libavformat/rtpenc.c
View file @
ab962722
...
@@ -124,7 +124,7 @@ static int rtp_write_header(AVFormatContext *s1)
...
@@ -124,7 +124,7 @@ static int rtp_write_header(AVFormatContext *s1)
if
(
!
s
->
ssrc
)
if
(
!
s
->
ssrc
)
s
->
ssrc
=
av_get_random_seed
();
s
->
ssrc
=
av_get_random_seed
();
s
->
first_packet
=
1
;
s
->
first_packet
=
1
;
s
->
first_rtcp_ntp_time
=
ff_ntp_time
(
av_gettime
()
);
s
->
first_rtcp_ntp_time
=
ff_ntp_time
();
if
(
s1
->
start_time_realtime
!=
0
&&
s1
->
start_time_realtime
!=
AV_NOPTS_VALUE
)
if
(
s1
->
start_time_realtime
!=
0
&&
s1
->
start_time_realtime
!=
AV_NOPTS_VALUE
)
/* Round the NTP time to whole milliseconds. */
/* Round the NTP time to whole milliseconds. */
s
->
first_rtcp_ntp_time
=
(
s1
->
start_time_realtime
/
1000
)
*
1000
+
s
->
first_rtcp_ntp_time
=
(
s1
->
start_time_realtime
/
1000
)
*
1000
+
...
@@ -526,9 +526,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
...
@@ -526,9 +526,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
rtcp_bytes
=
((
s
->
octet_count
-
s
->
last_octet_count
)
*
RTCP_TX_RATIO_NUM
)
/
rtcp_bytes
=
((
s
->
octet_count
-
s
->
last_octet_count
)
*
RTCP_TX_RATIO_NUM
)
/
RTCP_TX_RATIO_DEN
;
RTCP_TX_RATIO_DEN
;
if
((
s
->
first_packet
||
((
rtcp_bytes
>=
RTCP_SR_SIZE
)
&&
if
((
s
->
first_packet
||
((
rtcp_bytes
>=
RTCP_SR_SIZE
)
&&
(
ff_ntp_time
(
av_gettime
()
)
-
s
->
last_rtcp_ntp_time
>
5000000
)))
&&
(
ff_ntp_time
()
-
s
->
last_rtcp_ntp_time
>
5000000
)))
&&
!
(
s
->
flags
&
FF_RTP_FLAG_SKIP_RTCP
))
{
!
(
s
->
flags
&
FF_RTP_FLAG_SKIP_RTCP
))
{
rtcp_send_sr
(
s1
,
ff_ntp_time
(
av_gettime
()
),
0
);
rtcp_send_sr
(
s1
,
ff_ntp_time
(),
0
);
s
->
last_octet_count
=
s
->
octet_count
;
s
->
last_octet_count
=
s
->
octet_count
;
s
->
first_packet
=
0
;
s
->
first_packet
=
0
;
}
}
...
@@ -642,7 +642,7 @@ static int rtp_write_trailer(AVFormatContext *s1)
...
@@ -642,7 +642,7 @@ static int rtp_write_trailer(AVFormatContext *s1)
/* If the caller closes and recreates ->pb, this might actually
/* If the caller closes and recreates ->pb, this might actually
* be NULL here even if it was successfully allocated at the start. */
* be NULL here even if it was successfully allocated at the start. */
if
(
s1
->
pb
&&
(
s
->
flags
&
FF_RTP_FLAG_SEND_BYE
))
if
(
s1
->
pb
&&
(
s
->
flags
&
FF_RTP_FLAG_SEND_BYE
))
rtcp_send_sr
(
s1
,
ff_ntp_time
(
av_gettime
()
),
1
);
rtcp_send_sr
(
s1
,
ff_ntp_time
(),
1
);
av_freep
(
&
s
->
buf
);
av_freep
(
&
s
->
buf
);
return
0
;
return
0
;
...
...
libavformat/rtpenc.h
View file @
ab962722
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#ifndef AVFORMAT_RTPENC_H
#ifndef AVFORMAT_RTPENC_H
#define AVFORMAT_RTPENC_H
#define AVFORMAT_RTPENC_H
#include "libavutil/time.h"
#include "avformat.h"
#include "avformat.h"
#include "rtp.h"
#include "rtp.h"
...
...
libavformat/utils.c
View file @
ab962722
...
@@ -4684,9 +4684,9 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx)
...
@@ -4684,9 +4684,9 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx)
}
}
}
}
uint64_t
ff_ntp_time
(
int64_t
timestamp
)
uint64_t
ff_ntp_time
(
void
)
{
{
return
(
timestamp
/
1000
)
*
1000
+
NTP_OFFSET_US
;
return
(
av_gettime
()
/
1000
)
*
1000
+
NTP_OFFSET_US
;
}
}
uint64_t
ff_get_formatted_ntp_time
(
uint64_t
ntp_time_us
)
uint64_t
ff_get_formatted_ntp_time
(
uint64_t
ntp_time_us
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment