diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-04-11 02:05:49 +0200 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-04-18 02:15:50 +0200 |
commit | cef118032910230dc6ce845f76bfaf82277297f4 (patch) | |
tree | de7ce2382cbf55c0d88758f767e540832315cefa | |
parent | bc31a57902b83ae09221d53861c35dcb0109c4f7 (diff) | |
download | ffmpeg-cef118032910230dc6ce845f76bfaf82277297f4.tar.gz |
lavd/pulse_audio_enc: add buffer fullness messages
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
-rw-r--r-- | libavdevice/pulse_audio_enc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 6c02399e84..b05e12680e 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -48,13 +48,27 @@ static void pulse_stream_writable(pa_stream *stream, size_t nbytes, void *userda { AVFormatContext *h = userdata; PulseData *s = h->priv_data; + int64_t val = nbytes; if (stream != s->stream) return; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_WRITABLE, &val, sizeof(val)); pa_threaded_mainloop_signal(s->mainloop, 0); } +static void pulse_overflow(pa_stream *stream, void *userdata) +{ + AVFormatContext *h = userdata; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_OVERFLOW, NULL, 0); +} + +static void pulse_underflow(pa_stream *stream, void *userdata) +{ + AVFormatContext *h = userdata; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_UNDERFLOW, NULL, 0); +} + static void pulse_stream_state(pa_stream *stream, void *userdata) { PulseData *s = userdata; @@ -214,6 +228,8 @@ static av_cold int pulse_write_trailer(AVFormatContext *h) pa_stream_disconnect(s->stream); pa_stream_set_state_callback(s->stream, NULL, NULL); pa_stream_set_write_callback(s->stream, NULL, NULL); + pa_stream_set_overflow_callback(s->stream, NULL, NULL); + pa_stream_set_underflow_callback(s->stream, NULL, NULL); pa_stream_unref(s->stream); s->stream = NULL; } @@ -353,6 +369,8 @@ static av_cold int pulse_write_header(AVFormatContext *h) } pa_stream_set_state_callback(s->stream, pulse_stream_state, s); pa_stream_set_write_callback(s->stream, pulse_stream_writable, h); + pa_stream_set_overflow_callback(s->stream, pulse_overflow, h); + pa_stream_set_underflow_callback(s->stream, pulse_underflow, h); if ((ret = pa_stream_connect_playback(s->stream, s->device, &buffer_attributes, stream_flags, NULL, NULL)) < 0) { |