Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
51a23343
Commit
51a23343
authored
Sep 27, 2019
by
Timo Rothenpieler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/nvenc: pass CUstream to nvenc when available
Signed-off-by:
Timo Rothenpieler
<
timo@rothenpieler.org
>
parent
567b5e33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
nvenc.c
libavcodec/nvenc.c
+16
-4
nvenc.h
libavcodec/nvenc.h
+2
-0
No files found.
libavcodec/nvenc.c
View file @
51a23343
...
...
@@ -460,6 +460,7 @@ static av_cold int nvenc_check_device(AVCodecContext *avctx, int idx)
goto
fail
;
ctx
->
cu_context
=
ctx
->
cu_context_internal
;
ctx
->
cu_stream
=
NULL
;
if
((
ret
=
nvenc_pop_context
(
avctx
))
<
0
)
goto
fail2
;
...
...
@@ -546,6 +547,7 @@ static av_cold int nvenc_setup_device(AVCodecContext *avctx)
if
(
cuda_device_hwctx
)
{
ctx
->
cu_context
=
cuda_device_hwctx
->
cuda_ctx
;
ctx
->
cu_stream
=
cuda_device_hwctx
->
stream
;
}
#if CONFIG_D3D11VA
else
if
(
d3d11_device_hwctx
)
{
...
...
@@ -1245,15 +1247,25 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
return
res
;
nv_status
=
p_nvenc
->
nvEncInitializeEncoder
(
ctx
->
nvencoder
,
&
ctx
->
init_encode_params
);
if
(
nv_status
!=
NV_ENC_SUCCESS
)
{
nvenc_pop_context
(
avctx
);
return
nvenc_print_error
(
avctx
,
nv_status
,
"InitializeEncoder failed"
);
}
#ifdef NVENC_HAVE_CUSTREAM_PTR
if
(
ctx
->
cu_context
)
{
nv_status
=
p_nvenc
->
nvEncSetIOCudaStreams
(
ctx
->
nvencoder
,
&
ctx
->
cu_stream
,
&
ctx
->
cu_stream
);
if
(
nv_status
!=
NV_ENC_SUCCESS
)
{
nvenc_pop_context
(
avctx
);
return
nvenc_print_error
(
avctx
,
nv_status
,
"SetIOCudaStreams failed"
);
}
}
#endif
res
=
nvenc_pop_context
(
avctx
);
if
(
res
<
0
)
return
res
;
if
(
nv_status
!=
NV_ENC_SUCCESS
)
{
return
nvenc_print_error
(
avctx
,
nv_status
,
"InitializeEncoder failed"
);
}
if
(
ctx
->
encode_config
.
frameIntervalP
>
1
)
avctx
->
has_b_frames
=
2
;
...
...
libavcodec/nvenc.h
View file @
51a23343
...
...
@@ -57,6 +57,7 @@ typedef void ID3D11Device;
// SDK 9.1 compile time feature checks
#if NVENCAPI_CHECK_VERSION(9, 1)
#define NVENC_HAVE_MULTIPLE_REF_FRAMES
#define NVENC_HAVE_CUSTREAM_PTR
#endif
typedef
struct
NvencSurface
...
...
@@ -132,6 +133,7 @@ typedef struct NvencContext
NV_ENC_CONFIG
encode_config
;
CUcontext
cu_context
;
CUcontext
cu_context_internal
;
CUstream
cu_stream
;
ID3D11Device
*
d3d11_device
;
int
nb_surfaces
;
...
...
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