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
b316ebf4
Commit
b316ebf4
authored
Jun 20, 2016
by
Matthieu Bouron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/mediacodec: rely on buffer flags to detect end of stream
parent
30e3a271
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
mediacodecdec.c
libavcodec/mediacodecdec.c
+8
-9
mediacodecdec.h
libavcodec/mediacodecdec.h
+1
-2
No files found.
libavcodec/mediacodecdec.c
View file @
b316ebf4
...
@@ -396,7 +396,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
...
@@ -396,7 +396,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
need_flushing
=
1
;
need_flushing
=
1
;
}
}
if
(
s
->
flushing
&&
need_flushing
&&
s
->
queued_buffer_nb
<=
0
)
{
if
(
s
->
flushing
&&
s
->
eos
)
{
return
0
;
return
0
;
}
}
...
@@ -443,10 +443,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
...
@@ -443,10 +443,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to queue input buffer (status = %d)
\n
"
,
status
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to queue input buffer (status = %d)
\n
"
,
status
);
return
AVERROR_EXTERNAL
;
return
AVERROR_EXTERNAL
;
}
}
s
->
queued_buffer_nb
++
;
if
(
s
->
queued_buffer_nb
>
s
->
queued_buffer_max
)
s
->
queued_buffer_max
=
s
->
queued_buffer_nb
;
}
}
}
}
...
@@ -474,6 +470,10 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
...
@@ -474,6 +470,10 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
" flags=%"
PRIu32
"
\n
"
,
index
,
info
.
offset
,
info
.
size
,
" flags=%"
PRIu32
"
\n
"
,
index
,
info
.
offset
,
info
.
size
,
info
.
presentationTimeUs
,
info
.
flags
);
info
.
presentationTimeUs
,
info
.
flags
);
if
(
info
.
flags
&
ff_AMediaCodec_getBufferFlagEndOfStream
(
codec
))
{
s
->
eos
=
1
;
}
if
(
info
.
size
)
{
if
(
info
.
size
)
{
data
=
ff_AMediaCodec_getOutputBuffer
(
codec
,
index
,
&
size
);
data
=
ff_AMediaCodec_getOutputBuffer
(
codec
,
index
,
&
size
);
if
(
!
data
)
{
if
(
!
data
)
{
...
@@ -487,7 +487,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
...
@@ -487,7 +487,6 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
}
}
*
got_frame
=
1
;
*
got_frame
=
1
;
s
->
queued_buffer_nb
--
;
s
->
dequeued_buffer_nb
++
;
s
->
dequeued_buffer_nb
++
;
}
else
{
}
else
{
status
=
ff_AMediaCodec_releaseOutputBuffer
(
codec
,
index
,
0
);
status
=
ff_AMediaCodec_releaseOutputBuffer
(
codec
,
index
,
0
);
...
@@ -528,8 +527,8 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
...
@@ -528,8 +527,8 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
}
else
if
(
ff_AMediaCodec_infoTryAgainLater
(
codec
,
index
))
{
}
else
if
(
ff_AMediaCodec_infoTryAgainLater
(
codec
,
index
))
{
if
(
s
->
flushing
)
{
if
(
s
->
flushing
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to dequeue output buffer within %"
PRIi64
"ms "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to dequeue output buffer within %"
PRIi64
"ms "
"while flushing remaining frames, output will probably lack
last %d
frames
\n
"
,
"while flushing remaining frames, output will probably lack frames
\n
"
,
output_dequeue_timeout_us
/
1000
,
s
->
queued_buffer_nb
);
output_dequeue_timeout_us
/
1000
);
}
else
{
}
else
{
av_log
(
avctx
,
AV_LOG_DEBUG
,
"No output buffer available, try again later
\n
"
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"No output buffer available, try again later
\n
"
);
}
}
...
@@ -546,10 +545,10 @@ int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
...
@@ -546,10 +545,10 @@ int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
FFAMediaCodec
*
codec
=
s
->
codec
;
FFAMediaCodec
*
codec
=
s
->
codec
;
int
status
;
int
status
;
s
->
queued_buffer_nb
=
0
;
s
->
dequeued_buffer_nb
=
0
;
s
->
dequeued_buffer_nb
=
0
;
s
->
flushing
=
0
;
s
->
flushing
=
0
;
s
->
eos
=
0
;
status
=
ff_AMediaCodec_flush
(
codec
);
status
=
ff_AMediaCodec_flush
(
codec
);
if
(
status
<
0
)
{
if
(
status
<
0
)
{
...
...
libavcodec/mediacodecdec.h
View file @
b316ebf4
...
@@ -41,6 +41,7 @@ typedef struct MediaCodecDecContext {
...
@@ -41,6 +41,7 @@ typedef struct MediaCodecDecContext {
int
started
;
int
started
;
int
flushing
;
int
flushing
;
int
eos
;
int
width
;
int
width
;
int
height
;
int
height
;
...
@@ -53,8 +54,6 @@ typedef struct MediaCodecDecContext {
...
@@ -53,8 +54,6 @@ typedef struct MediaCodecDecContext {
int
crop_left
;
int
crop_left
;
int
crop_right
;
int
crop_right
;
int
queued_buffer_nb
;
int
queued_buffer_max
;
uint64_t
dequeued_buffer_nb
;
uint64_t
dequeued_buffer_nb
;
int
first_buffer
;
int
first_buffer
;
...
...
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