Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
70495aad
Commit
70495aad
authored
9 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: don't copy the AVPacket in ffmpeg_send_packet()
Reduce some overhead. It is not necessary to copy the object.
parent
f243f615
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+7
-8
No files found.
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
70495aad
...
...
@@ -349,7 +349,7 @@ PtsToPcmFrame(uint64_t pts, const AVStream &stream,
*/
static
DecoderCommand
ffmpeg_send_packet
(
Decoder
&
decoder
,
InputStream
&
is
,
const
AVPacket
&
packet
,
AVPacket
&
&
packet
,
AVCodecContext
&
codec_context
,
const
AVStream
&
stream
,
AVFrame
*
frame
,
...
...
@@ -370,17 +370,15 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
time_from_ffmpeg
(
pts
,
stream
.
time_base
));
}
AVPacket
packet2
=
packet
;
uint8_t
*
output_buffer
;
DecoderCommand
cmd
=
DecoderCommand
::
NONE
;
while
(
packet
2
.
size
>
0
&&
cmd
==
DecoderCommand
::
NONE
)
{
while
(
packet
.
size
>
0
&&
cmd
==
DecoderCommand
::
NONE
)
{
int
audio_size
=
0
;
int
got_frame
=
0
;
int
len
=
avcodec_decode_audio4
(
&
codec_context
,
frame
,
&
got_frame
,
&
packet
2
);
&
packet
);
if
(
len
>=
0
&&
got_frame
)
{
audio_size
=
copy_interleave_frame
(
codec_context
,
*
frame
,
...
...
@@ -397,8 +395,8 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
break
;
}
packet
2
.
data
+=
len
;
packet
2
.
size
-=
len
;
packet
.
data
+=
len
;
packet
.
size
-=
len
;
if
(
audio_size
<=
0
)
continue
;
...
...
@@ -631,7 +629,8 @@ ffmpeg_decode(Decoder &decoder, InputStream &input)
if
(
packet
.
stream_index
==
audio_stream
)
{
cmd
=
ffmpeg_send_packet
(
decoder
,
input
,
packet
,
*
codec_context
,
std
::
move
(
packet
),
*
codec_context
,
*
av_stream
,
frame
,
min_frame
,
audio_format
.
GetFrameSize
(),
...
...
This diff is collapsed.
Click to expand it.
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