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
67a8eedc
Commit
67a8eedc
authored
Jan 02, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/ao: round write_size down to a multiple of the frame size
parent
be65c7d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
NEWS
NEWS
+1
-0
AoOutputPlugin.cxx
src/output/plugins/AoOutputPlugin.cxx
+16
-2
No files found.
NEWS
View file @
67a8eedc
...
...
@@ -13,6 +13,7 @@ ver 0.21 (not yet released)
* output
- alsa: non-blocking mode
- alsa: change "dop" and "allowed_formats" settings at runtime
- ao: fix crash bug due to partial frames
- shout: support the Shine encoder plugin
- sndio: remove support for the broken RoarAudio sndio emulation
* mixer
...
...
src/output/plugins/AoOutputPlugin.cxx
View file @
67a8eedc
...
...
@@ -52,6 +52,8 @@ class AoOutput final : AudioOutput, SafeSingleton<AoInit> {
ao_option
*
options
=
nullptr
;
ao_device
*
device
;
size_t
frame_size
;
AoOutput
(
const
ConfigBlock
&
block
);
~
AoOutput
();
...
...
@@ -162,6 +164,8 @@ AoOutput::Open(AudioFormat &audio_format)
break
;
}
frame_size
=
audio_format
.
GetFrameSize
();
format
.
rate
=
audio_format
.
sample_rate
;
format
.
byte_format
=
AO_FMT_NATIVE
;
format
.
channels
=
audio_format
.
channels
;
...
...
@@ -180,8 +184,18 @@ AoOutput::Close() noexcept
size_t
AoOutput
::
Play
(
const
void
*
chunk
,
size_t
size
)
{
if
(
size
>
write_size
)
size
=
write_size
;
assert
(
size
%
frame_size
==
0
);
if
(
size
>
write_size
)
{
/* round down to a multiple of the frame size */
size
=
(
write_size
/
frame_size
)
*
frame_size
;
if
(
size
<
frame_size
)
/* no matter how small "write_size" was
configured, we must pass at least one frame
to libao */
size
=
frame_size
;
}
/* For whatever reason, libao wants a non-const pointer.
Let's hope it does not write to the buffer, and use the
...
...
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