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
18e2c0e7
Commit
18e2c0e7
authored
May 07, 2020
by
Limin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mpegvideo: return more specific error codes for ff_mpv_common_init()
Signed-off-by:
Limin Wang
<
lance.lmwang@gmail.com
>
parent
0032ca45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
mpegvideo.c
libavcodec/mpegvideo.c
+16
-14
No files found.
libavcodec/mpegvideo.c
View file @
18e2c0e7
...
@@ -907,7 +907,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -907,7 +907,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
if
(
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_NONE
)
{
if
(
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_NONE
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"decoding to AV_PIX_FMT_NONE is not supported.
\n
"
);
"decoding to AV_PIX_FMT_NONE is not supported.
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
if
(
nb_slices
>
MAX_THREADS
||
(
nb_slices
>
s
->
mb_height
&&
s
->
mb_height
))
{
if
(
nb_slices
>
MAX_THREADS
||
(
nb_slices
>
s
->
mb_height
&&
s
->
mb_height
))
{
...
@@ -923,7 +923,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -923,7 +923,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
if
((
s
->
width
||
s
->
height
)
&&
if
((
s
->
width
||
s
->
height
)
&&
av_image_check_size
(
s
->
width
,
s
->
height
,
0
,
s
->
avctx
))
av_image_check_size
(
s
->
width
,
s
->
height
,
0
,
s
->
avctx
))
return
-
1
;
return
AVERROR
(
EINVAL
)
;
dct_init
(
s
);
dct_init
(
s
);
...
@@ -935,27 +935,27 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -935,27 +935,27 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
return
ret
;
return
ret
;
FF_ALLOCZ_OR_GOTO
(
s
->
avctx
,
s
->
picture
,
FF_ALLOCZ_OR_GOTO
(
s
->
avctx
,
s
->
picture
,
MAX_PICTURE_COUNT
*
sizeof
(
Picture
),
fail
);
MAX_PICTURE_COUNT
*
sizeof
(
Picture
),
fail
_nomem
);
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
s
->
picture
[
i
].
f
=
av_frame_alloc
();
s
->
picture
[
i
].
f
=
av_frame_alloc
();
if
(
!
s
->
picture
[
i
].
f
)
if
(
!
s
->
picture
[
i
].
f
)
goto
fail
;
goto
fail
_nomem
;
}
}
s
->
next_picture
.
f
=
av_frame_alloc
();
s
->
next_picture
.
f
=
av_frame_alloc
();
if
(
!
s
->
next_picture
.
f
)
if
(
!
s
->
next_picture
.
f
)
goto
fail
;
goto
fail
_nomem
;
s
->
last_picture
.
f
=
av_frame_alloc
();
s
->
last_picture
.
f
=
av_frame_alloc
();
if
(
!
s
->
last_picture
.
f
)
if
(
!
s
->
last_picture
.
f
)
goto
fail
;
goto
fail
_nomem
;
s
->
current_picture
.
f
=
av_frame_alloc
();
s
->
current_picture
.
f
=
av_frame_alloc
();
if
(
!
s
->
current_picture
.
f
)
if
(
!
s
->
current_picture
.
f
)
goto
fail
;
goto
fail
_nomem
;
s
->
new_picture
.
f
=
av_frame_alloc
();
s
->
new_picture
.
f
=
av_frame_alloc
();
if
(
!
s
->
new_picture
.
f
)
if
(
!
s
->
new_picture
.
f
)
goto
fail
;
goto
fail
_nomem
;
if
(
init_context_frame
(
s
))
if
(
(
ret
=
init_context_frame
(
s
)
))
goto
fail
;
goto
fail
_nomem
;
s
->
parse_context
.
state
=
-
1
;
s
->
parse_context
.
state
=
-
1
;
...
@@ -969,9 +969,9 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -969,9 +969,9 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
if
(
i
)
{
if
(
i
)
{
s
->
thread_context
[
i
]
=
av_memdup
(
s
,
sizeof
(
MpegEncContext
));
s
->
thread_context
[
i
]
=
av_memdup
(
s
,
sizeof
(
MpegEncContext
));
if
(
!
s
->
thread_context
[
i
])
if
(
!
s
->
thread_context
[
i
])
goto
fail
;
goto
fail
_nomem
;
}
}
if
(
init_duplicate_context
(
s
->
thread_context
[
i
]
)
<
0
)
if
(
(
ret
=
init_duplicate_context
(
s
->
thread_context
[
i
])
)
<
0
)
goto
fail
;
goto
fail
;
s
->
thread_context
[
i
]
->
start_mb_y
=
s
->
thread_context
[
i
]
->
start_mb_y
=
(
s
->
mb_height
*
(
i
)
+
nb_slices
/
2
)
/
nb_slices
;
(
s
->
mb_height
*
(
i
)
+
nb_slices
/
2
)
/
nb_slices
;
...
@@ -979,7 +979,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -979,7 +979,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
(
s
->
mb_height
*
(
i
+
1
)
+
nb_slices
/
2
)
/
nb_slices
;
(
s
->
mb_height
*
(
i
+
1
)
+
nb_slices
/
2
)
/
nb_slices
;
}
}
}
else
{
}
else
{
if
(
init_duplicate_context
(
s
)
<
0
)
if
(
(
ret
=
init_duplicate_context
(
s
)
)
<
0
)
goto
fail
;
goto
fail
;
s
->
start_mb_y
=
0
;
s
->
start_mb_y
=
0
;
s
->
end_mb_y
=
s
->
mb_height
;
s
->
end_mb_y
=
s
->
mb_height
;
...
@@ -988,9 +988,11 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
...
@@ -988,9 +988,11 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
// }
// }
return
0
;
return
0
;
fail_nomem:
ret
=
AVERROR
(
ENOMEM
);
fail:
fail:
ff_mpv_common_end
(
s
);
ff_mpv_common_end
(
s
);
return
-
1
;
return
ret
;
}
}
/**
/**
...
...
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