Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
c3050fcb
Commit
c3050fcb
authored
8 years ago
by
Clément Bœsch
Committed by
Clément Bœsch
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
lavc/h264dec: remove flush goto in decode callback
parent
83a9cf36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/h264dec.c
+37
-33
37 additions, 33 deletions
libavcodec/h264dec.c
with
37 additions
and
33 deletions
libavcodec/h264dec.c
+
37
−
33
View file @
c3050fcb
...
@@ -966,6 +966,39 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g
...
@@ -966,6 +966,39 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g
return
0
;
return
0
;
}
}
static
int
send_next_delayed_frame
(
H264Context
*
h
,
AVFrame
*
dst_frame
,
int
*
got_frame
,
int
buf_index
)
{
int
ret
,
i
,
out_idx
;
H264Picture
*
out
=
h
->
delayed_pic
[
0
];
h
->
cur_pic_ptr
=
NULL
;
h
->
first_field
=
0
;
out_idx
=
0
;
for
(
i
=
1
;
h
->
delayed_pic
[
i
]
&&
!
h
->
delayed_pic
[
i
]
->
f
->
key_frame
&&
!
h
->
delayed_pic
[
i
]
->
mmco_reset
;
i
++
)
if
(
h
->
delayed_pic
[
i
]
->
poc
<
out
->
poc
)
{
out
=
h
->
delayed_pic
[
i
];
out_idx
=
i
;
}
for
(
i
=
out_idx
;
h
->
delayed_pic
[
i
];
i
++
)
h
->
delayed_pic
[
i
]
=
h
->
delayed_pic
[
i
+
1
];
if
(
out
)
{
out
->
reference
&=
~
DELAYED_PIC_REF
;
ret
=
finalize_frame
(
h
,
dst_frame
,
out
,
got_frame
);
if
(
ret
<
0
)
return
ret
;
}
return
buf_index
;
}
static
int
h264_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
h264_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
AVPacket
*
avpkt
)
int
*
got_frame
,
AVPacket
*
avpkt
)
{
{
...
@@ -973,9 +1006,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -973,9 +1006,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
H264Context
*
h
=
avctx
->
priv_data
;
H264Context
*
h
=
avctx
->
priv_data
;
AVFrame
*
pict
=
data
;
AVFrame
*
pict
=
data
;
int
buf_index
=
0
;
int
buf_index
;
H264Picture
*
out
;
int
i
,
out_idx
;
int
ret
;
int
ret
;
h
->
flags
=
avctx
->
flags
;
h
->
flags
=
avctx
->
flags
;
...
@@ -997,36 +1028,9 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -997,36 +1028,9 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
ff_h264_unref_picture
(
h
,
&
h
->
last_pic_for_ec
);
ff_h264_unref_picture
(
h
,
&
h
->
last_pic_for_ec
);
/* end of stream, output what is still in the buffers */
/* end of stream, output what is still in the buffers */
if
(
buf_size
==
0
)
{
if
(
buf_size
==
0
)
out:
return
send_next_delayed_frame
(
h
,
pict
,
got_frame
,
0
);
h
->
cur_pic_ptr
=
NULL
;
h
->
first_field
=
0
;
out
=
h
->
delayed_pic
[
0
];
out_idx
=
0
;
for
(
i
=
1
;
h
->
delayed_pic
[
i
]
&&
!
h
->
delayed_pic
[
i
]
->
f
->
key_frame
&&
!
h
->
delayed_pic
[
i
]
->
mmco_reset
;
i
++
)
if
(
h
->
delayed_pic
[
i
]
->
poc
<
out
->
poc
)
{
out
=
h
->
delayed_pic
[
i
];
out_idx
=
i
;
}
for
(
i
=
out_idx
;
h
->
delayed_pic
[
i
];
i
++
)
h
->
delayed_pic
[
i
]
=
h
->
delayed_pic
[
i
+
1
];
if
(
out
)
{
out
->
reference
&=
~
DELAYED_PIC_REF
;
ret
=
finalize_frame
(
h
,
pict
,
out
,
got_frame
);
if
(
ret
<
0
)
return
ret
;
}
return
buf_index
;
}
if
(
h
->
is_avc
&&
av_packet_get_side_data
(
avpkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
NULL
))
{
if
(
h
->
is_avc
&&
av_packet_get_side_data
(
avpkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
NULL
))
{
int
side_size
;
int
side_size
;
uint8_t
*
side
=
av_packet_get_side_data
(
avpkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
&
side_size
);
uint8_t
*
side
=
av_packet_get_side_data
(
avpkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
&
side_size
);
...
@@ -1048,7 +1052,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1048,7 +1052,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
if
(
!
h
->
cur_pic_ptr
&&
h
->
nal_unit_type
==
H264_NAL_END_SEQUENCE
)
{
if
(
!
h
->
cur_pic_ptr
&&
h
->
nal_unit_type
==
H264_NAL_END_SEQUENCE
)
{
av_assert0
(
buf_index
<=
buf_size
);
av_assert0
(
buf_index
<=
buf_size
);
goto
out
;
return
send_next_delayed_frame
(
h
,
pict
,
got_frame
,
buf_index
)
;
}
}
if
(
!
(
avctx
->
flags2
&
AV_CODEC_FLAG2_CHUNKS
)
&&
!
h
->
cur_pic_ptr
)
{
if
(
!
(
avctx
->
flags2
&
AV_CODEC_FLAG2_CHUNKS
)
&&
!
h
->
cur_pic_ptr
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment