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
f8ec3801
Commit
f8ec3801
authored
Aug 10, 2002
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocation of New buffers seems alright now.
parent
8e11bef5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
modules/codec/mad/decoder.c
modules/codec/mad/decoder.c
+1
-6
modules/codec/mad/libmad.c
modules/codec/mad/libmad.c
+19
-16
No files found.
modules/codec/mad/decoder.c
View file @
f8ec3801
...
...
@@ -219,14 +219,9 @@ static int InitThread( mad_adec_thread_t * p_mad_adec )
static
void
EndThread
(
mad_adec_thread_t
*
p_mad_adec
)
{
/* If the audio output fifo was created, we destroy it */
if
(
p_mad_adec
->
p_aout_
fifo
!=
NULL
)
if
(
p_mad_adec
->
p_aout_
input
!=
NULL
)
{
aout_InputDelete
(
p_mad_adec
->
p_aout
,
p_mad_adec
->
p_aout_input
);
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock
(
&
(
p_mad_adec
->
p_aout_fifo
->
data_lock
));
vlc_cond_signal
(
&
(
p_mad_adec
->
p_aout_fifo
->
data_wait
));
vlc_mutex_unlock
(
&
(
p_mad_adec
->
p_aout_fifo
->
data_lock
));
}
/* mad_decoder_finish releases the memory allocated inside the struct */
...
...
modules/codec/mad/libmad.c
View file @
f8ec3801
...
...
@@ -401,7 +401,7 @@ enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_heade
* is right for the entire audio track.
*/
if
(
(
p_mad_adec
->
p_aout_input
!=
NULL
)
&&
(
(
p_mad_adec
->
output_format
.
i_rate
!=
p_libmad_pcm
->
samplerate
)
(
p_mad_adec
->
output_format
.
i_rate
!=
p_libmad_pcm
->
samplerate
)
)
{
/* Parameters changed - this should not happen. */
aout_InputDelete
(
p_mad_adec
->
p_aout
,
p_mad_adec
->
p_aout_input
);
...
...
@@ -422,24 +422,27 @@ enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_heade
p_mad_adec
->
p_fifo
->
b_error
=
1
;
return
MAD_FLOW_BREAK
;
}
msg_Dbg
(
p_mad_adec
->
p_fifo
,
"aout3
buffer
created"
);
msg_Dbg
(
p_mad_adec
->
p_fifo
,
"aout3
input
created"
);
}
if
(
p_mad_adec
->
output_format
->
i_rate
!=
p_libmad_pcm
->
samplerate
)
if
(
p_mad_adec
->
output_format
.
i_rate
!=
p_libmad_pcm
->
samplerate
)
{
msg_Warn
(
p_mad_adec
->
p_fifo
,
"samplerate is changing from [%d] Hz "
"to [%d] Hz, sample size [%d], error_code [%0x]"
,
p_mad_adec
->
p_aout_fifo
->
i_rate
,
p_libmad_pcm
->
samplerate
,
p_mad_adec
->
output_format
.
i_rate
,
p_libmad_pcm
->
samplerate
,
p_libmad_pcm
->
length
,
p_mad_adec
->
libmad_decoder
->
sync
->
stream
.
error
);
p_mad_adec
->
output_format
.
i_rate
=
p_libmad_pcm
->
samplerate
;
}
/* Set the Presentation Time Stamp */
p_buffer
=
aout_BufferNew
(
p_mad_adec
->
p_aout
,
p_mad_adec
->
p_aout_input
,
(
p_libmad_pcm
->
length
*
4
)
);
p_buffer
=
aout_BufferNew
(
p_mad_adec
->
p_aout
,
p_mad_adec
->
p_aout_input
,
(
p_libmad_pcm
->
length
*
2
)
);
if
(
p_buffer
==
NULL
)
{
msg_Dbg
(
p_mad_adec
->
p_fifo
,
"allocating new buffer failed"
);
return
MAD_FLOW_BREAK
;
}
/* Add accurate PTS to buffer. */
...
...
@@ -451,9 +454,9 @@ enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_heade
{
p_buffer
->
start_date
=
LAST_MDATE
;
}
p_mad_adec
->
last_date
+=
(
mtime_t
)(
p_libmad_pcm
->
length
*
4
)
p_mad_adec
->
last_date
+=
(
mtime_t
)(
p_libmad_pcm
->
length
*
2
)
/
p_mad_adec
->
output_format
.
i_rate
;
p_buffer
->
end_date
=
p_mad_adec
->
last_date
;
p_buffer
->
end_date
=
p_mad_adec
->
i_next_pts
;
//
last_date;
/* Interleave and keep buffers in mad_fixed_t format */
while
(
nsamples
--
)
...
...
@@ -461,11 +464,11 @@ enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_heade
/* left audio channel */
sample
=
*
left_ch
++
;
#ifndef WORDS_BIGENDIAN
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
0
);
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
8
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
0
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
8
);
#else
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
8
);
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
0
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
8
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
0
);
#endif
/* right audio channel */
if
(
p_libmad_pcm
->
channels
==
2
)
...
...
@@ -473,11 +476,11 @@ enum mad_flow libmad_output3(void *data, struct mad_header const *p_libmad_heade
sample
=
*
right_ch
++
;
}
/* else reuse left audio channel */
#ifndef WORDS_BIGENDIAN
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
0
);
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
8
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
0
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
8
);
#else
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
8
);
p_buffer
->
p_buffer
++
=
(
mad_fixed
_t
)
(
sample
>>
0
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
8
);
*
(
p_buffer
->
p_buffer
)
++
=
(
byte
_t
)
(
sample
>>
0
);
#endif
}
...
...
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