Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
954a8f44
Commit
954a8f44
authored
10 years ago
by
Lukasz Marek
Browse files
Options
Downloads
Patches
Plain Diff
lavd/pulse_audio_enc: add more buffer attributes
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
e2ebaa09
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/outdevs.texi
+14
-0
14 additions, 0 deletions
doc/outdevs.texi
libavdevice/pulse_audio_enc.c
+16
-0
16 additions, 0 deletions
libavdevice/pulse_audio_enc.c
with
30 additions
and
0 deletions
doc/outdevs.texi
+
14
−
0
View file @
954a8f44
...
@@ -290,6 +290,20 @@ When both options are provided then the highest value is used
...
@@ -290,6 +290,20 @@ When both options are provided then the highest value is used
are set to 0 (which is default), the device will use the default
are set to 0 (which is default), the device will use the default
PulseAudio duration value. By default PulseAudio set buffer duration
PulseAudio duration value. By default PulseAudio set buffer duration
to around 2 seconds.
to around 2 seconds.
@item prebuf
Specify pre-buffering size in bytes. The server does not start with
playback before at least @option{prebuf} bytes are available in the
buffer. By default this option is initialized to the same value as
@option{buffer_size} or @option{buffer_duration} (whichever is bigger).
@item minreq
Specify minimum request size in bytes. The server does not request less
than @option{minreq} bytes from the client, instead waits until the buffer
is free enough to request more bytes at once. It is recommended to not set
this option, which will initialize this to a value that is deemed sensible
by the server.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
This diff is collapsed.
Click to expand it.
libavdevice/pulse_audio_enc.c
+
16
−
0
View file @
954a8f44
...
@@ -38,6 +38,8 @@ typedef struct PulseData {
...
@@ -38,6 +38,8 @@ typedef struct PulseData {
int64_t
timestamp
;
int64_t
timestamp
;
int
buffer_size
;
/**< Buffer size in bytes */
int
buffer_size
;
/**< Buffer size in bytes */
int
buffer_duration
;
/**< Buffer size in ms, recalculated to buffer_size */
int
buffer_duration
;
/**< Buffer size in ms, recalculated to buffer_size */
int
prebuf
;
int
minreq
;
int
last_result
;
int
last_result
;
pa_threaded_mainloop
*
mainloop
;
pa_threaded_mainloop
*
mainloop
;
pa_context
*
ctx
;
pa_context
*
ctx
;
...
@@ -475,6 +477,10 @@ static av_cold int pulse_write_header(AVFormatContext *h)
...
@@ -475,6 +477,10 @@ static av_cold int pulse_write_header(AVFormatContext *h)
av_log
(
s
,
AV_LOG_DEBUG
,
"Real buffer length is %u bytes
\n
"
,
buffer_attributes
.
tlength
);
av_log
(
s
,
AV_LOG_DEBUG
,
"Real buffer length is %u bytes
\n
"
,
buffer_attributes
.
tlength
);
}
else
if
(
s
->
buffer_size
)
}
else
if
(
s
->
buffer_size
)
buffer_attributes
.
tlength
=
s
->
buffer_size
;
buffer_attributes
.
tlength
=
s
->
buffer_size
;
if
(
s
->
prebuf
)
buffer_attributes
.
prebuf
=
s
->
prebuf
;
if
(
s
->
minreq
)
buffer_attributes
.
minreq
=
s
->
minreq
;
sample_spec
.
format
=
ff_codec_id_to_pulse_format
(
st
->
codec
->
codec_id
);
sample_spec
.
format
=
ff_codec_id_to_pulse_format
(
st
->
codec
->
codec_id
);
sample_spec
.
rate
=
st
->
codec
->
sample_rate
;
sample_spec
.
rate
=
st
->
codec
->
sample_rate
;
...
@@ -578,6 +584,14 @@ static av_cold int pulse_write_header(AVFormatContext *h)
...
@@ -578,6 +584,14 @@ static av_cold int pulse_write_header(AVFormatContext *h)
goto
fail
;
goto
fail
;
}
}
/* read back buffer attributes for future use */
buffer_attributes
=
*
pa_stream_get_buffer_attr
(
s
->
stream
);
s
->
buffer_size
=
buffer_attributes
.
tlength
;
s
->
prebuf
=
buffer_attributes
.
prebuf
;
s
->
minreq
=
buffer_attributes
.
minreq
;
av_log
(
s
,
AV_LOG_DEBUG
,
"Real buffer attributes: size: %d, prebuf: %d, minreq: %d
\n
"
,
s
->
buffer_size
,
s
->
prebuf
,
s
->
minreq
);
pa_threaded_mainloop_unlock
(
s
->
mainloop
);
pa_threaded_mainloop_unlock
(
s
->
mainloop
);
if
((
ret
=
pulse_subscribe_events
(
s
))
<
0
)
{
if
((
ret
=
pulse_subscribe_events
(
s
))
<
0
)
{
...
@@ -745,6 +759,8 @@ static const AVOption options[] = {
...
@@ -745,6 +759,8 @@ static const AVOption options[] = {
{
"device"
,
"set device name"
,
OFFSET
(
device
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
E
},
{
"device"
,
"set device name"
,
OFFSET
(
device
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
E
},
{
"buffer_size"
,
"set buffer size in bytes"
,
OFFSET
(
buffer_size
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
"buffer_size"
,
"set buffer size in bytes"
,
OFFSET
(
buffer_size
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
"buffer_duration"
,
"set buffer duration in millisecs"
,
OFFSET
(
buffer_duration
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
"buffer_duration"
,
"set buffer duration in millisecs"
,
OFFSET
(
buffer_duration
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
"prebuf"
,
"set pre-buffering size"
,
OFFSET
(
prebuf
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
"minreq"
,
"set minimum request size"
,
OFFSET
(
minreq
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
E
},
{
NULL
}
{
NULL
}
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment