Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
f8e94001
Commit
f8e94001
authored
Nov 06, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: handle filters creation/deletion from decoder, fix memory leak
parent
5864ae43
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
37 deletions
+25
-37
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+3
-5
src/audio_output/dec.c
src/audio_output/dec.c
+17
-14
src/audio_output/filters.c
src/audio_output/filters.c
+1
-1
src/audio_output/input.c
src/audio_output/input.c
+4
-17
No files found.
src/audio_output/aout_internal.h
View file @
f8e94001
...
...
@@ -108,10 +108,8 @@ static inline aout_owner_t *aout_owner (audio_output_t *aout)
*****************************************************************************/
/* From input.c : */
aout_input_t
*
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
const
audio_sample_format_t
*
,
const
aout_request_vout_t
*
);
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
);
aout_input_t
*
aout_InputNew
(
const
audio_sample_format_t
*
);
void
aout_InputDelete
(
aout_input_t
*
);
block_t
*
aout_InputPlay
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
block_t
*
p_buffer
,
int
i_input_rate
,
date_t
*
);
...
...
@@ -125,7 +123,7 @@ void aout_FiltersPlay( filter_t *const *, unsigned, block_t ** );
int
aout_FiltersNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
const
audio_sample_format_t
*
,
const
aout_request_vout_t
*
);
void
aout_FiltersDe
stroy
(
audio_output_t
*
);
void
aout_FiltersDe
lete
(
audio_output_t
*
);
/* From mixer.c : */
aout_volume_t
*
aout_volume_New
(
vlc_object_t
*
,
const
audio_replay_gain_t
*
);
...
...
src/audio_output/dec.c
View file @
f8e94001
...
...
@@ -83,19 +83,21 @@ int aout_DecNew( audio_output_t *p_aout,
aout_volume_SetFormat
(
owner
->
volume
,
owner
->
mixer_format
.
i_format
);
/* Create the audio filtering "input" pipeline */
date_Init
(
&
owner
->
sync
.
date
,
owner
->
mixer_format
.
i_rate
,
1
);
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
assert
(
owner
->
input
==
NULL
);
owner
->
input
=
aout_InputNew
(
p_aout
,
p_format
,
&
owner
->
mixer_format
,
p_request_vout
);
if
(
owner
->
input
==
NULL
)
if
(
aout_FiltersNew
(
p_aout
,
p_format
,
&
owner
->
mixer_format
,
p_request_vout
))
{
aout_OutputDelete
(
p_aout
);
error:
aout_volume_Delete
(
owner
->
volume
);
ret
=
-
1
;
goto
error
;
}
date_Init
(
&
owner
->
sync
.
date
,
owner
->
mixer_format
.
i_rate
,
1
);
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
assert
(
owner
->
input
==
NULL
);
owner
->
input
=
aout_InputNew
(
p_format
);
aout_unlock
(
p_aout
);
return
ret
;
}
...
...
@@ -111,17 +113,16 @@ void aout_DecDelete (audio_output_t *p_aout)
aout_lock
(
p_aout
);
/* Remove the input. */
input
=
owner
->
input
;
if
(
likely
(
input
!=
NULL
))
aout_InputDelete
(
p_aout
,
input
);
aout_InputDelete
(
input
);
owner
->
input
=
NULL
;
aout_FiltersDelete
(
p_aout
);
aout_OutputDelete
(
p_aout
);
aout_volume_Delete
(
owner
->
volume
);
var_Destroy
(
p_aout
,
"stereo-mode"
);
aout_unlock
(
p_aout
);
free
(
input
);
}
#define AOUT_RESTART_OUTPUT 1
...
...
@@ -140,10 +141,11 @@ static void aout_CheckRestart (audio_output_t *aout)
const
aout_request_vout_t
request_vout
=
owner
->
request_vout
;
if
(
likely
(
owner
->
input
!=
NULL
))
aout_InputDelete
(
aout
,
owner
->
input
);
aout_InputDelete
(
owner
->
input
);
owner
->
input
=
NULL
;
aout_FiltersDelete
(
aout
);
/* Reinitializes the output */
if
(
restart
&
AOUT_RESTART_OUTPUT
)
{
...
...
@@ -156,8 +158,9 @@ static void aout_CheckRestart (audio_output_t *aout)
aout_volume_SetFormat
(
owner
->
volume
,
owner
->
mixer_format
.
i_format
);
}
owner
->
input
=
aout_InputNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
&
request_vout
);
if
(
aout_FiltersNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
&
request_vout
)
==
0
)
owner
->
input
=
aout_InputNew
(
&
owner
->
input_format
);
}
/**
...
...
src/audio_output/filters.c
View file @
f8e94001
...
...
@@ -518,7 +518,7 @@ error:
/**
* Destroys the audio filters.
*/
void
aout_FiltersDe
stroy
(
audio_output_t
*
aout
)
void
aout_FiltersDe
lete
(
audio_output_t
*
aout
)
{
aout_owner_t
*
owner
=
aout_owner
(
aout
);
...
...
src/audio_output/input.c
View file @
f8e94001
...
...
@@ -43,23 +43,12 @@ static void inputResamplingStop( audio_output_t *, aout_input_t * );
/*****************************************************************************
* aout_InputNew : allocate a new input and rework the filter pipeline
*****************************************************************************/
aout_input_t
*
aout_InputNew
(
audio_output_t
*
p_aout
,
const
audio_sample_format_t
*
restrict
infmt
,
const
audio_sample_format_t
*
restrict
outfmt
,
const
aout_request_vout_t
*
p_request_vout
)
aout_input_t
*
aout_InputNew
(
const
audio_sample_format_t
*
restrict
infmt
)
{
aout_input_t
*
p_input
=
malloc
(
sizeof
(
*
p_input
));
if
(
unlikely
(
p_input
==
NULL
))
return
NULL
;
aout_input_t
*
p_input
=
xmalloc
(
sizeof
(
*
p_input
));
p_input
->
samplerate
=
infmt
->
i_rate
;
if
(
aout_FiltersNew
(
p_aout
,
infmt
,
outfmt
,
p_request_vout
))
{
free
(
p_input
);
return
NULL
;
}
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
p_input
->
i_last_input_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
i_buffer_lost
=
0
;
...
...
@@ -71,11 +60,9 @@ aout_input_t *aout_InputNew (audio_output_t * p_aout,
*****************************************************************************
* This function must be entered with the mixer lock.
*****************************************************************************/
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
)
void
aout_InputDelete
(
aout_input_t
*
p_input
)
{
aout_FiltersDestroy
(
p_aout
);
(
void
)
p_input
;
return
0
;
free
(
p_input
);
}
/*****************************************************************************
...
...
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