Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
dbd79a6b
Commit
dbd79a6b
authored
Jun 19, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a few bugs in mp3_decode and minimize alsa underruns by playing silence when switch songs
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1572
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
7f155366
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
10 deletions
+20
-10
audio.c
src/audio.c
+5
-0
audio.h
src/audio.h
+2
-0
decode.c
src/decode.c
+8
-3
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+4
-5
ogg_plugin.c
src/inputPlugins/ogg_plugin.c
+1
-2
No files found.
src/audio.c
View file @
dbd79a6b
...
...
@@ -278,6 +278,11 @@ int playAudio(char * playChunk, int size) {
return
0
;
}
int
isAudioDeviceOpen
()
{
if
(
audio_device
)
return
1
;
return
0
;
}
void
closeAudioDevice
()
{
#ifdef HAVE_AUDIO
if
(
audio_device
)
{
...
...
src/audio.h
View file @
dbd79a6b
...
...
@@ -49,6 +49,8 @@ int playAudio(char * playChunk,int size);
void
closeAudioDevice
();
int
isAudioDeviceOpen
();
void
audioError
();
int
isCurrentAudioFormat
(
AudioFormat
*
audioFormat
);
...
...
src/decode.c
View file @
dbd79a6b
...
...
@@ -98,6 +98,12 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
return
(
int
)
chunks
;
}
#define playSilenceOrSleep() \
if(isAudioDeviceOpen()) { \
playAudio(silence, CHUNK_SIZE); \
} \
else my_usleep(10000);
#define handleDecodeStart() \
if(decodeWaitedOn) { \
if(dc->state!=DECODE_STATE_START && *decode_pid > 0 && \
...
...
@@ -128,7 +134,7 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
return; \
} \
else { \
my_usleep(10000); \
my_usleep(10000); \
continue; \
} \
}
...
...
@@ -462,9 +468,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
dc
->
state
!=
DECODE_STATE_STOP
)
{
processDecodeInput
();
handleDecodeStart
();
if
(
quit
)
return
;
my_usleep
(
10000
);
playSilenceOrSleep
(
);
}
while
(
!
quit
)
{
...
...
src/inputPlugins/mp3_plugin.c
View file @
dbd79a6b
...
...
@@ -575,12 +575,12 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
MP3_DATA_OUTPUT_BUFFER_SIZE
,
data
->
elapsedTime
,
data
->
bitRate
/
1000
);
data
->
outputPtr
=
data
->
outputBuffer
;
if
(
ret
==
OUTPUT_BUFFER_DC_STOP
)
{
return
DECODE_BREAK
;
}
data
->
outputPtr
=
data
->
outputBuffer
;
if
(
ret
==
OUTPUT_BUFFER_DC_SEEK
)
break
;
}
}
...
...
@@ -640,7 +640,7 @@ void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, AudioFormat * af) {
int
mp3_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
,
InputStream
*
inStream
)
{
mp3DecodeData
data
;
MpdTag
*
tag
;
MpdTag
*
tag
=
NULL
;
if
(
openMp3FromInputStream
(
inStream
,
&
data
,
dc
,
&
tag
)
<
0
)
{
closeInputStream
(
inStream
);
...
...
@@ -664,7 +664,6 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
if
(
tag
)
freeMpdTag
(
tag
);
tag
=
newMpdTag
();
tag
->
title
=
strdup
(
inStream
->
metaTitle
);
/* free ths now, so we know we are done with it */
free
(
inStream
->
metaTitle
);
inStream
->
metaTitle
=
NULL
;
if
(
inStream
->
metaName
)
{
...
...
@@ -694,7 +693,7 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
while
(
mp3Read
(
&
data
,
cb
,
dc
)
!=
DECODE_BREAK
);
/* send last little bit if not dc->stop */
if
(
data
.
outputPtr
!=
data
.
outputBuffer
&&
data
.
flush
)
{
if
(
!
dc
->
stop
&&
data
.
outputPtr
!=
data
.
outputBuffer
&&
data
.
flush
)
{
sendDataToOutputBuffer
(
cb
,
NULL
,
dc
,
data
.
inStream
->
seekable
,
data
.
outputBuffer
,
...
...
src/inputPlugins/ogg_plugin.c
View file @
dbd79a6b
...
...
@@ -321,9 +321,8 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
ov_pcm_tell
(
&
vf
)
/
dc
->
audioFormat
.
sampleRate
,
bitRate
);
if
(
dc
->
stop
)
break
;
chunkpos
=
0
;
if
(
dc
->
stop
)
break
;
}
}
...
...
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