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
922ab4d4
Commit
922ab4d4
authored
Aug 19, 2002
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More changes in the date handling. Should be more tolerant with
pause/play and change of audio channel.
parent
9a1fd919
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
139 deletions
+147
-139
include/aout_internal.h
include/aout_internal.h
+15
-18
modules/audio_output/file.c
modules/audio_output/file.c
+7
-2
modules/misc/dummy/aout.c
modules/misc/dummy/aout.c
+3
-1
src/audio_output/audio_output.c
src/audio_output/audio_output.c
+3
-4
src/audio_output/input.c
src/audio_output/input.c
+14
-29
src/audio_output/mixer.c
src/audio_output/mixer.c
+96
-77
src/audio_output/output.c
src/audio_output/output.c
+9
-8
No files found.
include/aout_internal.h
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.
6 2002/08/19 21:31:11
massiot Exp $
* $Id: aout_internal.h,v 1.
7 2002/08/19 23:12:57
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -82,7 +82,6 @@ typedef struct aout_alloc_t
*****************************************************************************/
typedef
struct
aout_fifo_t
{
vlc_mutex_t
lock
;
struct
aout_buffer_t
*
p_first
;
struct
aout_buffer_t
**
pp_last
;
mtime_t
end_date
;
...
...
@@ -91,7 +90,6 @@ typedef struct aout_fifo_t
static
inline
void
aout_FifoInit
(
struct
aout_instance_t
*
p_aout
,
aout_fifo_t
*
p_fifo
)
{
vlc_mutex_init
(
(
vlc_object_t
*
)
p_aout
,
&
p_fifo
->
lock
);
p_fifo
->
p_first
=
NULL
;
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
p_fifo
->
end_date
=
0
;
...
...
@@ -101,7 +99,6 @@ static inline void aout_FifoPush( struct aout_instance_t * p_aout,
aout_fifo_t
*
p_fifo
,
aout_buffer_t
*
p_buffer
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
*
p_fifo
->
pp_last
=
p_buffer
;
p_fifo
->
pp_last
=
&
p_buffer
->
p_next
;
*
p_fifo
->
pp_last
=
NULL
;
...
...
@@ -118,26 +115,31 @@ static inline void aout_FifoPush( struct aout_instance_t * p_aout,
{
p_fifo
->
end_date
=
p_buffer
->
end_date
;
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
}
static
inline
mtime_t
aout_FifoNextStart
(
struct
aout_instance_t
*
p_aout
,
aout_fifo_t
*
p_fifo
)
{
mtime_t
end_date
;
vlc_mutex_lock
(
&
p_fifo
->
lock
);
end_date
=
p_fifo
->
end_date
;
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
return
end_date
;
return
p_fifo
->
end_date
;
}
/* Reinit the end_date (for instance after a pause). */
static
inline
void
aout_FifoSet
(
struct
aout_instance_t
*
p_aout
,
aout_fifo_t
*
p_fifo
,
mtime_t
date
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
)
;
aout_buffer_t
*
p_buffer
;
p_fifo
->
end_date
=
date
;
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
/* Remove all buffers. */
p_buffer
=
p_fifo
->
p_first
;
while
(
p_buffer
!=
NULL
)
{
aout_buffer_t
*
p_next
=
p_buffer
->
p_next
;
aout_BufferFree
(
p_buffer
);
p_buffer
=
p_next
;
}
p_fifo
->
p_first
=
NULL
;
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
/* This function supposes there is at least one buffer in p_fifo. */
...
...
@@ -145,14 +147,12 @@ static inline aout_buffer_t * aout_FifoPop( struct aout_instance_t * p_aout,
aout_fifo_t
*
p_fifo
)
{
aout_buffer_t
*
p_buffer
;
vlc_mutex_lock
(
&
p_fifo
->
lock
);
p_buffer
=
p_fifo
->
p_first
;
p_fifo
->
p_first
=
p_buffer
->
p_next
;
if
(
p_fifo
->
p_first
==
NULL
)
{
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
return
p_buffer
;
}
...
...
@@ -162,7 +162,6 @@ static inline void aout_FifoDestroy( struct aout_instance_t * p_aout,
{
aout_buffer_t
*
p_buffer
;
vlc_mutex_destroy
(
&
p_fifo
->
lock
);
p_buffer
=
p_fifo
->
p_first
;
while
(
p_buffer
!=
NULL
)
{
...
...
@@ -260,9 +259,7 @@ struct aout_instance_t
int
i_nb_inputs
;
/* Mixer */
vlc_cond_t
mixer_signal
;
/* the associated mutex is
* p_aout->output.fifo.lock */
vlc_bool_t
b_mixer_active
;
vlc_mutex_t
mixer_lock
;
aout_mixer_t
mixer
;
/* Output plug-in */
...
...
modules/audio_output/file.c
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* file.c : audio output which writes the samples to a file
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: file.c,v 1.
7 2002/08/19 23:07:30 sam
Exp $
* $Id: file.c,v 1.
8 2002/08/19 23:12:57 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -148,7 +148,12 @@ static int SetFormat( aout_instance_t * p_aout )
*****************************************************************************/
static
void
Play
(
aout_instance_t
*
p_aout
)
{
aout_buffer_t
*
p_buffer
=
aout_FifoPop
(
p_aout
,
&
p_aout
->
output
.
fifo
);
aout_buffer_t
*
p_buffer
;
/* We don't need the mixer lock, since Play is entered _with_ the
* mixer lock. */
p_buffer
=
aout_FifoPop
(
p_aout
,
&
p_aout
->
output
.
fifo
);
if
(
fwrite
(
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_bytes
,
1
,
(
FILE
*
)
p_aout
->
output
.
p_sys
)
!=
1
)
{
...
...
modules/misc/dummy/aout.c
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout.c,v 1.
5 2002/08/19 21:31:11
massiot Exp $
* $Id: aout.c,v 1.
6 2002/08/19 23:12:57
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -77,6 +77,8 @@ static int SetFormat( aout_instance_t * p_aout )
*****************************************************************************/
static
void
Play
(
aout_instance_t
*
p_aout
)
{
/* We don't need the mixer lock, since Play is entered _with_ the
* mixer lock. */
aout_buffer_t
*
p_buffer
=
aout_FifoPop
(
p_aout
,
&
p_aout
->
output
.
fifo
);
aout_BufferFree
(
p_buffer
);
}
...
...
src/audio_output/audio_output.c
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* audio_output.c : audio output instance
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.c,v 1.9
7 2002/08/19 21:31:11
massiot Exp $
* $Id: audio_output.c,v 1.9
8 2002/08/19 23:12:57
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -57,8 +57,7 @@ aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent )
p_aout
->
b_change_requested
=
0
;
p_aout
->
i_nb_inputs
=
0
;
vlc_cond_init
(
p_parent
,
&
p_aout
->
mixer_signal
);
p_aout
->
b_mixer_active
=
0
;
vlc_mutex_init
(
p_parent
,
&
p_aout
->
mixer_lock
);
vlc_object_attach
(
p_aout
,
p_parent
->
p_vlc
);
...
...
@@ -72,7 +71,7 @@ void aout_DeleteInstance( aout_instance_t * p_aout )
{
vlc_mutex_destroy
(
&
p_aout
->
input_lock
);
vlc_cond_destroy
(
&
p_aout
->
input_signal
);
vlc_
cond_destroy
(
&
p_aout
->
mixer_signal
);
vlc_
mutex_destroy
(
&
p_aout
->
mixer_lock
);
/* Free structure. */
vlc_object_destroy
(
p_aout
);
...
...
src/audio_output/input.c
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* input.c : internal management of input streams for the audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: input.c,v 1.
5 2002/08/19 21:31:11
massiot Exp $
* $Id: input.c,v 1.
6 2002/08/19 23:12:57
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -42,13 +42,7 @@ static aout_input_t * InputNew( aout_instance_t * p_aout,
if
(
p_input
==
NULL
)
return
NULL
;
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
while
(
p_aout
->
b_mixer_active
)
{
vlc_cond_wait
(
&
p_aout
->
mixer_signal
,
&
p_aout
->
output
.
fifo
.
lock
);
}
p_aout
->
b_mixer_active
=
1
;
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
if
(
p_aout
->
i_nb_inputs
==
0
)
{
...
...
@@ -110,18 +104,12 @@ static aout_input_t * InputNew( aout_instance_t * p_aout,
{
aout_MixerNew
(
p_aout
);
}
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
p_aout
->
b_mixer_active
=
0
;
vlc_cond_signal
(
&
p_aout
->
mixer_signal
);
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
return
NULL
;
}
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
p_aout
->
b_mixer_active
=
0
;
vlc_cond_signal
(
&
p_aout
->
mixer_signal
);
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
/* Prepare hints for the buffer allocator. */
p_input
->
input_alloc
.
i_alloc_type
=
AOUT_ALLOC_HEAP
;
...
...
@@ -177,15 +165,7 @@ void aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
{
int
i_input
;
msg_Dbg
(
p_aout
,
"input 0x%x destroyed"
,
p_input
);
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
while
(
p_aout
->
b_mixer_active
)
{
vlc_cond_wait
(
&
p_aout
->
mixer_signal
,
&
p_aout
->
output
.
fifo
.
lock
);
}
p_aout
->
b_mixer_active
=
1
;
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
for
(
i_input
=
0
;
i_input
<
p_aout
->
i_nb_inputs
;
i_input
++
)
{
...
...
@@ -206,10 +186,7 @@ void aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
(
AOUT_MAX_INPUTS
-
i_input
-
1
)
*
sizeof
(
aout_input_t
*
)
);
p_aout
->
i_nb_inputs
--
;
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
p_aout
->
b_mixer_active
=
0
;
vlc_cond_signal
(
&
p_aout
->
mixer_signal
);
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
aout_FiltersDestroyPipeline
(
p_aout
,
p_input
->
pp_filters
,
p_input
->
i_nb_filters
);
...
...
@@ -222,6 +199,8 @@ void aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
aout_OutputDelete
(
p_aout
);
aout_MixerDelete
(
p_aout
);
}
msg_Dbg
(
p_aout
,
"input 0x%x destroyed"
,
p_input
);
}
/*****************************************************************************
...
...
@@ -252,7 +231,9 @@ void aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
* happen :). */
msg_Warn
(
p_aout
,
"Computed PTS is out of range (%lld), clearing out"
,
start_date
);
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
aout_FifoSet
(
p_aout
,
&
p_input
->
fifo
,
0
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
start_date
=
0
;
}
...
...
@@ -314,7 +295,9 @@ void aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
&
new_output
)
<
0
)
{
msg_Err
(
p_aout
,
"couldn't set an input pipeline for resampling"
);
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
aout_FifoSet
(
p_aout
,
&
p_input
->
fifo
,
0
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
aout_BufferFree
(
p_buffer
);
vlc_mutex_lock
(
&
p_aout
->
input_lock
);
...
...
@@ -347,7 +330,9 @@ void aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Adding the start date will be managed by aout_FifoPush(). */
p_buffer
->
start_date
=
start_date
;
p_buffer
->
end_date
=
start_date
+
duration
;
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
aout_FifoPush
(
p_aout
,
&
p_input
->
fifo
,
p_buffer
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
vlc_mutex_lock
(
&
p_aout
->
input_lock
);
p_aout
->
i_inputs_active
--
;
...
...
src/audio_output/mixer.c
View file @
922ab4d4
This diff is collapsed.
Click to expand it.
src/audio_output/output.c
View file @
922ab4d4
...
...
@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: output.c,v 1.
7 2002/08/19 21:31:11
massiot Exp $
* $Id: output.c,v 1.
8 2002/08/19 23:12:57
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -43,9 +43,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
int
i_channels
=
config_GetInt
(
p_aout
,
"aout-channels"
);
/* Prepare FIFO. */
vlc_mutex_init
(
p_aout
,
&
p_aout
->
output
.
fifo
.
lock
);
p_aout
->
output
.
fifo
.
p_first
=
NULL
;
p_aout
->
output
.
fifo
.
pp_last
=
&
p_aout
->
output
.
fifo
.
p_first
;
aout_FifoInit
(
p_aout
,
&
p_aout
->
output
.
fifo
);
p_aout
->
output
.
p_module
=
module_Need
(
p_aout
,
"audio output"
,
psz_name
);
...
...
@@ -151,6 +149,7 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
p_aout
->
output
.
i_nb_filters
,
&
p_buffer
);
/* Please remember that we have the mixer_lock in this function. */
aout_FifoPush
(
p_aout
,
&
p_aout
->
output
.
fifo
,
p_buffer
);
p_aout
->
output
.
pf_play
(
p_aout
);
...
...
@@ -169,7 +168,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
{
aout_buffer_t
*
p_buffer
;
vlc_mutex_lock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_lock
(
&
p_aout
->
mixer_
lock
);
p_buffer
=
p_aout
->
output
.
fifo
.
p_first
;
while
(
p_buffer
!=
NULL
&&
p_buffer
->
end_date
<
start_date
)
...
...
@@ -183,7 +182,9 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
if
(
p_buffer
==
NULL
)
{
p_aout
->
output
.
fifo
.
pp_last
=
&
p_aout
->
output
.
fifo
.
p_first
;
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
/* Set date to 0, to allow the mixer to send a new buffer ASAP */
p_aout
->
output
.
fifo
.
end_date
=
0
;
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
msg_Dbg
(
p_aout
,
"audio output is starving"
);
return
NULL
;
}
...
...
@@ -193,7 +194,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
if
(
p_buffer
->
start_date
>
start_date
+
(
p_buffer
->
end_date
-
p_buffer
->
start_date
)
)
{
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_
lock
);
msg_Dbg
(
p_aout
,
"audio output is starving (%lld)"
,
p_buffer
->
start_date
-
start_date
);
return
NULL
;
...
...
@@ -222,6 +223,6 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
p_aout
->
output
.
fifo
.
pp_last
=
&
p_aout
->
output
.
fifo
.
p_first
;
}
vlc_mutex_unlock
(
&
p_aout
->
output
.
fifo
.
lock
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_
lock
);
return
p_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