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
076be809
Commit
076be809
authored
Jun 23, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Music{Pipe,Chunk}: use MusicChunkPtr for the list links
parent
88f1233d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
16 deletions
+12
-16
MusicChunk.hxx
src/MusicChunk.hxx
+1
-1
MusicPipe.cxx
src/MusicPipe.cxx
+7
-11
MusicPipe.hxx
src/MusicPipe.hxx
+3
-3
SharedPipeConsumer.cxx
src/output/SharedPipeConsumer.cxx
+1
-1
No files found.
src/MusicChunk.hxx
View file @
076be809
...
...
@@ -45,7 +45,7 @@ struct MusicChunk;
*/
struct
MusicChunkInfo
{
/** the next chunk in a linked list */
MusicChunk
*
next
;
MusicChunk
Ptr
next
;
/**
* An optional chunk which should be mixed into this chunk.
...
...
src/MusicPipe.cxx
View file @
076be809
...
...
@@ -28,7 +28,7 @@ MusicPipe::Contains(const MusicChunk *chunk) const noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
for
(
const
MusicChunk
*
i
=
head
;
i
!=
nullptr
;
i
=
i
->
next
)
for
(
const
MusicChunk
*
i
=
head
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
()
)
if
(
i
==
chunk
)
return
true
;
...
...
@@ -42,11 +42,11 @@ MusicPipe::Shift() noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
MusicChunk
*
chunk
=
head
;
auto
chunk
=
std
::
move
(
head
)
;
if
(
chunk
!=
nullptr
)
{
assert
(
!
chunk
->
IsEmpty
());
head
=
chunk
->
next
;
head
=
std
::
move
(
chunk
->
next
)
;
--
size
;
if
(
head
==
nullptr
)
{
...
...
@@ -60,15 +60,12 @@ MusicPipe::Shift() noexcept
}
#ifndef NDEBUG
/* poison the "next" reference */
chunk
->
next
=
(
MusicChunk
*
)(
void
*
)
0x01010101
;
if
(
size
==
0
)
audio_format
.
Clear
();
#endif
}
return
MusicChunkPtr
(
chunk
,
MusicChunkDeleter
(
buffer
))
;
return
chunk
;
}
void
...
...
@@ -94,10 +91,9 @@ MusicPipe::Push(MusicChunkPtr chunk) noexcept
audio_format
=
chunk
->
audio_format
;
#endif
auto
*
c
=
chunk
.
release
();
c
->
next
=
nullptr
;
*
tail_r
=
c
;
tail_r
=
&
c
->
next
;
chunk
->
next
.
reset
();
*
tail_r
=
std
::
move
(
chunk
);
tail_r
=
&
(
*
tail_r
)
->
next
;
++
size
;
}
src/MusicPipe.hxx
View file @
076be809
...
...
@@ -43,10 +43,10 @@ class MusicPipe {
MusicBuffer
&
buffer
;
/** the first chunk */
MusicChunk
*
head
=
nullptr
;
MusicChunk
Ptr
head
;
/** a pointer to the tail of the chunk */
MusicChunk
*
*
tail_r
=
&
head
;
MusicChunk
Ptr
*
tail_r
=
&
head
;
/** the current number of chunks */
unsigned
size
=
0
;
...
...
@@ -102,7 +102,7 @@ public:
gcc_pure
const
MusicChunk
*
Peek
()
const
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
return
head
;
return
head
.
get
()
;
}
/**
...
...
src/output/SharedPipeConsumer.cxx
View file @
076be809
...
...
@@ -33,7 +33,7 @@ SharedPipeConsumer::Get() noexcept
return
nullptr
;
consumed
=
false
;
return
chunk
=
chunk
->
next
;
return
chunk
=
chunk
->
next
.
get
()
;
}
else
{
/* get the first chunk from the pipe */
consumed
=
false
;
...
...
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