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
ceb00f78
Commit
ceb00f78
authored
Apr 25, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: added assertions on dc.pipe
dc.pipe must be non-NULL while the decoder thread is running. Ensure that with a load of assertions.
parent
d01d1cca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
decoder_api.c
src/decoder_api.c
+11
-0
decoder_control.c
src/decoder_control.c
+2
-0
No files found.
src/decoder_api.c
View file @
ceb00f78
...
@@ -42,6 +42,7 @@ void decoder_initialized(G_GNUC_UNUSED struct decoder * decoder,
...
@@ -42,6 +42,7 @@ void decoder_initialized(G_GNUC_UNUSED struct decoder * decoder,
bool
seekable
,
float
total_time
)
bool
seekable
,
float
total_time
)
{
{
assert
(
dc
.
state
==
DECODE_STATE_START
);
assert
(
dc
.
state
==
DECODE_STATE_START
);
assert
(
dc
.
pipe
!=
NULL
);
assert
(
decoder
!=
NULL
);
assert
(
decoder
!=
NULL
);
assert
(
decoder
->
stream_tag
==
NULL
);
assert
(
decoder
->
stream_tag
==
NULL
);
assert
(
decoder
->
decoder_tag
==
NULL
);
assert
(
decoder
->
decoder_tag
==
NULL
);
...
@@ -73,11 +74,15 @@ void decoder_initialized(G_GNUC_UNUSED struct decoder * decoder,
...
@@ -73,11 +74,15 @@ void decoder_initialized(G_GNUC_UNUSED struct decoder * decoder,
char
*
decoder_get_uri
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
char
*
decoder_get_uri
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
{
{
assert
(
dc
.
pipe
!=
NULL
);
return
song_get_uri
(
dc
.
current_song
);
return
song_get_uri
(
dc
.
current_song
);
}
}
enum
decoder_command
decoder_get_command
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
enum
decoder_command
decoder_get_command
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
{
{
assert
(
dc
.
pipe
!=
NULL
);
return
dc
.
command
;
return
dc
.
command
;
}
}
...
@@ -86,6 +91,7 @@ void decoder_command_finished(G_GNUC_UNUSED struct decoder * decoder)
...
@@ -86,6 +91,7 @@ void decoder_command_finished(G_GNUC_UNUSED struct decoder * decoder)
assert
(
dc
.
command
!=
DECODE_COMMAND_NONE
);
assert
(
dc
.
command
!=
DECODE_COMMAND_NONE
);
assert
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
assert
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
dc
.
seek_error
||
decoder
->
seeking
);
dc
.
seek_error
||
decoder
->
seeking
);
assert
(
dc
.
pipe
!=
NULL
);
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
{
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
{
/* delete frames from the old song position */
/* delete frames from the old song position */
...
@@ -105,6 +111,7 @@ void decoder_command_finished(G_GNUC_UNUSED struct decoder * decoder)
...
@@ -105,6 +111,7 @@ void decoder_command_finished(G_GNUC_UNUSED struct decoder * decoder)
double
decoder_seek_where
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
double
decoder_seek_where
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
{
{
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
pipe
!=
NULL
);
decoder
->
seeking
=
true
;
decoder
->
seeking
=
true
;
...
@@ -114,6 +121,7 @@ double decoder_seek_where(G_GNUC_UNUSED struct decoder * decoder)
...
@@ -114,6 +121,7 @@ double decoder_seek_where(G_GNUC_UNUSED struct decoder * decoder)
void
decoder_seek_error
(
struct
decoder
*
decoder
)
void
decoder_seek_error
(
struct
decoder
*
decoder
)
{
{
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
pipe
!=
NULL
);
dc
.
seek_error
=
true
;
dc
.
seek_error
=
true
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
...
@@ -128,6 +136,7 @@ size_t decoder_read(struct decoder *decoder,
...
@@ -128,6 +136,7 @@ size_t decoder_read(struct decoder *decoder,
assert
(
decoder
==
NULL
||
assert
(
decoder
==
NULL
||
dc
.
state
==
DECODE_STATE_START
||
dc
.
state
==
DECODE_STATE_START
||
dc
.
state
==
DECODE_STATE_DECODE
);
dc
.
state
==
DECODE_STATE_DECODE
);
assert
(
dc
.
pipe
!=
NULL
);
assert
(
is
!=
NULL
);
assert
(
is
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
NULL
);
...
@@ -219,6 +228,7 @@ decoder_data(struct decoder *decoder,
...
@@ -219,6 +228,7 @@ decoder_data(struct decoder *decoder,
const
char
*
data
=
_data
;
const
char
*
data
=
_data
;
assert
(
dc
.
state
==
DECODE_STATE_DECODE
);
assert
(
dc
.
state
==
DECODE_STATE_DECODE
);
assert
(
dc
.
pipe
!=
NULL
);
assert
(
length
%
audio_format_frame_size
(
&
dc
.
in_audio_format
)
==
0
);
assert
(
length
%
audio_format_frame_size
(
&
dc
.
in_audio_format
)
==
0
);
if
(
dc
.
command
==
DECODE_COMMAND_STOP
||
if
(
dc
.
command
==
DECODE_COMMAND_STOP
||
...
@@ -322,6 +332,7 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, struct input_stream *is,
...
@@ -322,6 +332,7 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, struct input_stream *is,
enum
decoder_command
cmd
;
enum
decoder_command
cmd
;
assert
(
dc
.
state
==
DECODE_STATE_DECODE
);
assert
(
dc
.
state
==
DECODE_STATE_DECODE
);
assert
(
dc
.
pipe
!=
NULL
);
assert
(
tag
!=
NULL
);
assert
(
tag
!=
NULL
);
/* save the tag */
/* save the tag */
...
...
src/decoder_control.c
View file @
ceb00f78
...
@@ -60,6 +60,7 @@ static void dc_command_async(enum decoder_command cmd)
...
@@ -60,6 +60,7 @@ static void dc_command_async(enum decoder_command cmd)
void
void
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
)
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
)
{
{
assert
(
dc
.
pipe
!=
NULL
);
assert
(
song
!=
NULL
);
assert
(
song
!=
NULL
);
dc
.
next_song
=
song
;
dc
.
next_song
=
song
;
...
@@ -69,6 +70,7 @@ dc_start(struct notify *notify, struct song *song)
...
@@ -69,6 +70,7 @@ dc_start(struct notify *notify, struct song *song)
void
void
dc_start_async
(
struct
song
*
song
)
dc_start_async
(
struct
song
*
song
)
{
{
assert
(
dc
.
pipe
!=
NULL
);
assert
(
song
!=
NULL
);
assert
(
song
!=
NULL
);
dc
.
next_song
=
song
;
dc
.
next_song
=
song
;
...
...
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