Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
V
V8
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
V8
Commits
4e041468
Commit
4e041468
authored
Nov 01, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to libx264 with CPU once h264_nvenc fail to init.
parent
4d3dda41
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
builtins-encoder.cc
src/builtins/builtins-encoder.cc
+19
-5
No files found.
src/builtins/builtins-encoder.cc
View file @
4e041468
...
@@ -65,14 +65,28 @@ BUILTIN(InitEncodeContext) {
...
@@ -65,14 +65,28 @@ BUILTIN(InitEncodeContext) {
bitrate
->
ToUint32
(
&
bitrate_int
);
bitrate
->
ToUint32
(
&
bitrate_int
);
framerate
->
ToUint32
(
&
framerate_int
);
framerate
->
ToUint32
(
&
framerate_int
);
// First try to use h264_nvenc which may failed due
// to host has no GPU.
enc
=
new
LAIPIC_ENCODER
::
Encoder
{
enc
=
new
LAIPIC_ENCODER
::
Encoder
{
libpath_cppstr
,
outpath
,
width_int
,
height_int
,
bitrate_int
,
AV_PIX_FMT_YUV420P
,
30
,
"h264_nvenc"
};
libpath_cppstr
,
outpath
,
width_int
,
height_int
,
bitrate_int
,
AV_PIX_FMT_YUV420P
,
30
,
"h264_nvenc"
};
if
(
!
enc
->
isReady
())
{
// Then try to use libx264 to working with CPU
// Release old encoder
enc
->
close
();
enc
=
new
LAIPIC_ENCODER
::
Encoder
{
libpath_cppstr
,
outpath
,
width_int
,
height_int
,
bitrate_int
,
AV_PIX_FMT_YUV420P
,
30
,
"libx264"
};
if
(
!
enc
->
isReady
())
{
if
(
!
enc
->
isReady
())
{
// Fail to initialize LAIPIC_ENCODER::Encoder.
// Fail to initialize LAIPIC_ENCODER::Encoder.
// Probaly cause of invalid arguments.
// Probaly cause of invalid arguments.
THROW_NEW_ERROR_RETURN_FAILURE
(
isolate
,
THROW_NEW_ERROR_RETURN_FAILURE
(
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
isolate
,
NewEvalError
(
MessageTemplate
::
kInvalidArgument
));
}
}
}
inited
=
true
;
inited
=
true
;
...
...
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