Commit d1f38334 authored by Lukasz Marek's avatar Lukasz Marek Committed by Stefano Sabatini

lavd/pulse_audio_enc: add support for flushing

Signed-off-by: 's avatarLukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: 's avatarStefano Sabatini <stefasab@gmail.com>
parent 2d8ccf0a
...@@ -98,14 +98,20 @@ static av_cold int pulse_write_trailer(AVFormatContext *h) ...@@ -98,14 +98,20 @@ static av_cold int pulse_write_trailer(AVFormatContext *h)
static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt) static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt)
{ {
PulseData *s = h->priv_data; PulseData *s = h->priv_data;
int size = pkt->size;
uint8_t *buf = pkt->data;
int error; int error;
if (!pkt) {
if (pa_simple_flush(s->pa, &error) < 0) {
av_log(s, AV_LOG_ERROR, "pa_simple_flush failed: %s\n", pa_strerror(error));
return AVERROR(EIO);
}
return 0;
}
if (s->stream_index != pkt->stream_index) if (s->stream_index != pkt->stream_index)
return 0; return 0;
if (pa_simple_write(s->pa, buf, size, &error) < 0) { if (pa_simple_write(s->pa, pkt->data, pkt->size, &error) < 0) {
av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error)); av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error));
return AVERROR(EIO); return AVERROR(EIO);
} }
...@@ -149,6 +155,6 @@ AVOutputFormat ff_pulse_muxer = { ...@@ -149,6 +155,6 @@ AVOutputFormat ff_pulse_muxer = {
.write_packet = pulse_write_packet, .write_packet = pulse_write_packet,
.write_trailer = pulse_write_trailer, .write_trailer = pulse_write_trailer,
.get_output_timestamp = pulse_get_output_timestamp, .get_output_timestamp = pulse_get_output_timestamp,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH,
.priv_class = &pulse_muxer_class, .priv_class = &pulse_muxer_class,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment