Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ebc321e8
Commit
ebc321e8
authored
Mar 09, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: zero copy audio decoding
parent
78f1c31a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+22
-16
No files found.
modules/codec/avcodec/audio.c
View file @
ebc321e8
...
...
@@ -353,31 +353,37 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
p_dec
->
fmt_out
.
audio
.
i_format
);
if
(
ctx
->
channels
>
AV_NUM_DATA_POINTERS
)
free
(
frame
.
extended_data
);
block_Release
(
p_block
);
p_block
=
p_buffer
;
}
else
/*
TODO: zero copy... need to replace decoder_NewAudioBuffer()
*/
memcpy
(
p_buffer
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i
_buffer
);
else
/*
FIXME: improve decoder_NewAudioBuffer(), avoid useless buffer...
*/
block_Release
(
p
_buffer
);
if
(
p_sys
->
b_extract
)
{
/* TODO: do not drop channels... at least not here */
aout_ChannelExtract
(
p_block
->
p_buffer
,
p_buffer
=
block_Alloc
(
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
*
frame
.
nb_samples
);
if
(
unlikely
(
p_buffer
==
NULL
)
)
{
block_Release
(
p_block
);
return
NULL
;
}
aout_ChannelExtract
(
p_buffer
->
p_buffer
,
p_dec
->
fmt_out
.
audio
.
i_channels
,
p_b
uffer
->
p_buffer
,
ctx
->
channels
,
p_b
lock
->
p_buffer
,
ctx
->
channels
,
frame
.
nb_samples
,
p_sys
->
pi_extraction
,
p_dec
->
fmt_out
.
audio
.
i_bitspersample
);
block_Release
(
p_buffer
);
p_buffer
=
p_block
;
}
else
block_Release
(
p_block
);
p_block
=
p_buffer
;
}
p_buffer
->
i_nb_samples
=
frame
.
nb_samples
;
p_buffer
->
i_buffer
=
frame
.
nb_samples
*
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
;
p_buffer
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_buffer
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
frame
.
nb_samples
)
-
p_buffer
->
i_pts
;
return
p_buffer
;
p_block
->
i_nb_samples
=
frame
.
nb_samples
;
p_block
->
i_buffer
=
frame
.
nb_samples
*
p_dec
->
fmt_out
.
audio
.
i_bytes_per_frame
;
p_block
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
frame
.
nb_samples
)
-
p_block
->
i_pts
;
return
p_block
;
end:
block_Release
(
p_block
);
...
...
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