Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
6616fd00
Commit
6616fd00
authored
Apr 22, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used a better audio output frame size in avcodec depending on the codec.
parent
f2a77200
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+21
-3
No files found.
modules/codec/avcodec/audio.c
View file @
6616fd00
...
@@ -72,6 +72,7 @@ struct decoder_sys_t
...
@@ -72,6 +72,7 @@ struct decoder_sys_t
FFMPEG_COMMON_MEMBERS
FFMPEG_COMMON_MEMBERS
/* Temporary buffer for libavcodec */
/* Temporary buffer for libavcodec */
int
i_output_max
;
uint8_t
*
p_output
;
uint8_t
*
p_output
;
/*
/*
...
@@ -203,7 +204,24 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -203,7 +204,24 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
p_sys
->
p_output
=
malloc
(
AVCODEC_MAX_AUDIO_FRAME_SIZE
);
switch
(
i_codec_id
)
{
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 16, 0 )
case
CODEC_ID_WAVPACK
:
p_sys
->
i_output_max
=
8
*
sizeof
(
int32_t
)
*
131072
;
break
;
#endif
case
CODEC_ID_FLAC
:
p_sys
->
i_output_max
=
8
*
sizeof
(
int32_t
)
*
65535
;
break
;
default:
p_sys
->
i_output_max
=
0
;
break
;
}
if
(
p_sys
->
i_output_max
<
AVCODEC_MAX_AUDIO_FRAME_SIZE
)
p_sys
->
i_output_max
=
AVCODEC_MAX_AUDIO_FRAME_SIZE
;
msg_Dbg
(
p_dec
,
"Using %d bytes output buffer"
,
p_sys
->
i_output_max
);
p_sys
->
p_output
=
malloc
(
p_sys
->
i_output_max
);
p_sys
->
p_samples
=
NULL
;
p_sys
->
p_samples
=
NULL
;
p_sys
->
i_samples
=
0
;
p_sys
->
i_samples
=
0
;
p_sys
->
i_reject_count
=
0
;
p_sys
->
i_reject_count
=
0
;
...
@@ -292,7 +310,8 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
...
@@ -292,7 +310,8 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
block_Release
(
p_block
);
block_Release
(
p_block
);
return
NULL
;
return
NULL
;
}
}
if
(
p_block
->
i_buffer
>
AVCODEC_MAX_AUDIO_FRAME_SIZE
)
i_output
=
__MAX
(
p_block
->
i_buffer
,
p_sys
->
i_output_max
);
if
(
i_output
<
p_sys
->
i_output_max
)
{
{
/* Grow output buffer if necessary (eg. for PCM data) */
/* Grow output buffer if necessary (eg. for PCM data) */
p_sys
->
p_output
=
realloc
(
p_sys
->
p_output
,
p_block
->
i_buffer
);
p_sys
->
p_output
=
realloc
(
p_sys
->
p_output
,
p_block
->
i_buffer
);
...
@@ -305,7 +324,6 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
...
@@ -305,7 +324,6 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
memset
(
&
p_block
->
p_buffer
[
p_block
->
i_buffer
],
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
memset
(
&
p_block
->
p_buffer
[
p_block
->
i_buffer
],
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
i_output
=
__MAX
(
AVCODEC_MAX_AUDIO_FRAME_SIZE
,
p_block
->
i_buffer
);
i_used
=
avcodec_decode_audio2
(
p_sys
->
p_context
,
i_used
=
avcodec_decode_audio2
(
p_sys
->
p_context
,
(
int16_t
*
)
p_sys
->
p_output
,
&
i_output
,
(
int16_t
*
)
p_sys
->
p_output
,
&
i_output
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
p_block
->
p_buffer
,
p_block
->
i_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