[FFmpeg-devel] [PATCH 2/2] avdevice/pulse_audio_enc: add support for flushing

Michael Niedermayer michaelni at gmx.at
Sat Oct 19 00:46:02 CEST 2013


On Sat, Oct 19, 2013 at 12:03:10AM +0200, Stefano Sabatini wrote:
> On date Friday 2013-10-18 23:41:20 +0200, Lukasz Marek encoded:
> > Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> > ---
> >  libavdevice/pulse_audio_enc.c |   14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
> > index 0a3aa1a..5343696 100644
> > --- a/libavdevice/pulse_audio_enc.c
> > +++ b/libavdevice/pulse_audio_enc.c
> > @@ -98,14 +98,20 @@ static av_cold int pulse_write_trailer(AVFormatContext *h)
> >  static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt)
> >  {
> >      PulseData *s = h->priv_data;
> > -    int size     = pkt->size;
> > -    uint8_t *buf = pkt->data;
> >      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)
> >          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));
> >          return AVERROR(EIO);
> >      }
> > @@ -149,6 +155,6 @@ AVOutputFormat ff_pulse_muxer = {
> >      .write_packet   = pulse_write_packet,
> >      .write_trailer  = pulse_write_trailer,
> >      .get_output_timestamp = pulse_get_output_timestamp,
> > -    .flags          = AVFMT_NOFILE,
> > +    .flags          = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH,
> >      .priv_class     = &pulse_muxer_class,
> >  };
> 
> LGTM but I'd prefer a second check from someone with more indepth into
> lavf/lavd internal API.

its a fairly simple patch it should be fine


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131019/80f747b4/attachment.asc>


More information about the ffmpeg-devel mailing list