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
b91e0e59
Commit
b91e0e59
authored
Sep 09, 2016
by
Timo Rothenpieler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/cuvid: check for and warn about invalid pkt_timebase
parent
132adf73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
cuvid.c
libavcodec/cuvid.c
+11
-2
No files found.
libavcodec/cuvid.c
View file @
b91e0e59
...
...
@@ -258,7 +258,10 @@ static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
avpkt
->
pts
!=
AV_NOPTS_VALUE
)
{
cupkt
.
flags
=
CUVID_PKT_TIMESTAMP
;
cupkt
.
timestamp
=
av_rescale_q
(
avpkt
->
pts
,
avctx
->
pkt_timebase
,
(
AVRational
){
1
,
10000000
});
if
(
avctx
->
pkt_timebase
.
num
&&
avctx
->
pkt_timebase
.
den
)
cupkt
.
timestamp
=
av_rescale_q
(
avpkt
->
pts
,
avctx
->
pkt_timebase
,
(
AVRational
){
1
,
10000000
});
else
cupkt
.
timestamp
=
avpkt
->
pts
;
}
}
else
{
cupkt
.
flags
=
CUVID_PKT_ENDOFSTREAM
;
...
...
@@ -363,7 +366,10 @@ static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
frame
->
width
=
avctx
->
width
;
frame
->
height
=
avctx
->
height
;
frame
->
pts
=
av_rescale_q
(
dispinfo
.
timestamp
,
(
AVRational
){
1
,
10000000
},
avctx
->
pkt_timebase
);
if
(
avctx
->
pkt_timebase
.
num
&&
avctx
->
pkt_timebase
.
den
)
frame
->
pts
=
av_rescale_q
(
dispinfo
.
timestamp
,
(
AVRational
){
1
,
10000000
},
avctx
->
pkt_timebase
);
else
frame
->
pts
=
dispinfo
.
timestamp
;
/* CUVIDs opaque reordering breaks the internal pkt logic.
* So set pkt_pts and clear all the other pkt_ fields.
...
...
@@ -679,6 +685,9 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
ctx
->
ever_flushed
=
0
;
if
(
!
avctx
->
pkt_timebase
.
num
||
!
avctx
->
pkt_timebase
.
den
)
av_log
(
avctx
,
AV_LOG_WARNING
,
"Invalid pkt_timebase, passing timestamps as-is.
\n
"
);
return
0
;
error:
...
...
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