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
5b013733
Commit
5b013733
authored
Jun 27, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: more assertions in class PeriodBuffer
parent
a92aa0be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
PeriodBuffer.hxx
src/lib/alsa/PeriodBuffer.hxx
+11
-1
No files found.
src/lib/alsa/PeriodBuffer.hxx
View file @
5b013733
...
@@ -83,6 +83,8 @@ public:
...
@@ -83,6 +83,8 @@ public:
* which may have been postponed by FillWithSilence().
* which may have been postponed by FillWithSilence().
*/
*/
bool
IsDrained
()
const
noexcept
{
bool
IsDrained
()
const
noexcept
{
assert
(
IsFull
());
/* compare head with capacity, not with tail; this
/* compare head with capacity, not with tail; this
method makes only sense if the period is full */
method makes only sense if the period is full */
return
head
>=
capacity
;
return
head
>=
capacity
;
...
@@ -95,6 +97,8 @@ public:
...
@@ -95,6 +97,8 @@ public:
* commit the operation.
* commit the operation.
*/
*/
uint8_t
*
GetTail
()
noexcept
{
uint8_t
*
GetTail
()
noexcept
{
assert
(
!
IsFull
());
return
buffer
+
tail
;
return
buffer
+
tail
;
}
}
...
@@ -105,7 +109,7 @@ public:
...
@@ -105,7 +109,7 @@ public:
* in bytes
* in bytes
*/
*/
size_t
GetSpaceBytes
()
const
noexcept
{
size_t
GetSpaceBytes
()
const
noexcept
{
assert
(
tail
<=
capacity
);
assert
(
!
IsFull
()
);
return
capacity
-
tail
;
return
capacity
-
tail
;
}
}
...
@@ -159,10 +163,14 @@ public:
...
@@ -159,10 +163,14 @@ public:
* GetHead().
* GetHead().
*/
*/
snd_pcm_uframes_t
GetFrames
(
size_t
frame_size
)
const
noexcept
{
snd_pcm_uframes_t
GetFrames
(
size_t
frame_size
)
const
noexcept
{
assert
(
IsFull
());
return
(
tail
-
head
)
/
frame_size
;
return
(
tail
-
head
)
/
frame_size
;
}
}
void
ConsumeBytes
(
size_t
n
)
noexcept
{
void
ConsumeBytes
(
size_t
n
)
noexcept
{
assert
(
IsFull
());
head
+=
n
;
head
+=
n
;
assert
(
head
<=
capacity
);
assert
(
head
<=
capacity
);
...
@@ -177,6 +185,8 @@ public:
...
@@ -177,6 +185,8 @@ public:
}
}
void
ConsumeFrames
(
snd_pcm_uframes_t
n
,
size_t
frame_size
)
noexcept
{
void
ConsumeFrames
(
snd_pcm_uframes_t
n
,
size_t
frame_size
)
noexcept
{
assert
(
IsFull
());
ConsumeBytes
(
n
*
frame_size
);
ConsumeBytes
(
n
*
frame_size
);
}
}
...
...
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