Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Lukasz Marek authored on 2014/04/11 09:05:49... | ... |
@@ -48,13 +48,27 @@ static void pulse_stream_writable(pa_stream *stream, size_t nbytes, void *userda |
48 | 48 |
{ |
49 | 49 |
AVFormatContext *h = userdata; |
50 | 50 |
PulseData *s = h->priv_data; |
51 |
+ int64_t val = nbytes; |
|
51 | 52 |
|
52 | 53 |
if (stream != s->stream) |
53 | 54 |
return; |
54 | 55 |
|
56 |
+ avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_WRITABLE, &val, sizeof(val)); |
|
55 | 57 |
pa_threaded_mainloop_signal(s->mainloop, 0); |
56 | 58 |
} |
57 | 59 |
|
60 |
+static void pulse_overflow(pa_stream *stream, void *userdata) |
|
61 |
+{ |
|
62 |
+ AVFormatContext *h = userdata; |
|
63 |
+ avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_OVERFLOW, NULL, 0); |
|
64 |
+} |
|
65 |
+ |
|
66 |
+static void pulse_underflow(pa_stream *stream, void *userdata) |
|
67 |
+{ |
|
68 |
+ AVFormatContext *h = userdata; |
|
69 |
+ avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_UNDERFLOW, NULL, 0); |
|
70 |
+} |
|
71 |
+ |
|
58 | 72 |
static void pulse_stream_state(pa_stream *stream, void *userdata) |
59 | 73 |
{ |
60 | 74 |
PulseData *s = userdata; |
... | ... |
@@ -214,6 +228,8 @@ static av_cold int pulse_write_trailer(AVFormatContext *h) |
214 | 214 |
pa_stream_disconnect(s->stream); |
215 | 215 |
pa_stream_set_state_callback(s->stream, NULL, NULL); |
216 | 216 |
pa_stream_set_write_callback(s->stream, NULL, NULL); |
217 |
+ pa_stream_set_overflow_callback(s->stream, NULL, NULL); |
|
218 |
+ pa_stream_set_underflow_callback(s->stream, NULL, NULL); |
|
217 | 219 |
pa_stream_unref(s->stream); |
218 | 220 |
s->stream = NULL; |
219 | 221 |
} |
... | ... |
@@ -353,6 +369,8 @@ static av_cold int pulse_write_header(AVFormatContext *h) |
353 | 353 |
} |
354 | 354 |
pa_stream_set_state_callback(s->stream, pulse_stream_state, s); |
355 | 355 |
pa_stream_set_write_callback(s->stream, pulse_stream_writable, h); |
356 |
+ pa_stream_set_overflow_callback(s->stream, pulse_overflow, h); |
|
357 |
+ pa_stream_set_underflow_callback(s->stream, pulse_underflow, h); |
|
356 | 358 |
|
357 | 359 |
if ((ret = pa_stream_connect_playback(s->stream, s->device, &buffer_attributes, |
358 | 360 |
stream_flags, NULL, NULL)) < 0) { |