[FFmpeg-devel] [PATCH 2/2] lavd/pulse_audio_enc: allow non monotonic streams

Michael Niedermayer michaelni at gmx.at
Wed Jan 8 14:34:53 CET 2014


On Wed, Jan 08, 2014 at 01:51:36PM +0100, Lukasz M wrote:
> >
> >
> > > OTOH, I am afraid this patchset is wrong for another reason: if a
> > timestamp
> > > discontinuity is feed to the device, then av_get_output_timestamp() will
> > > return strange results while the samples around the discontinuity are in
> > the
> > > device buffer. I believe the application should not pass through the
> > > timestamps from the input and rather synthesize its own monotonic
> > > timestamps.
> >
> 
> I did expect that flush is done before writing packet with discontinued
> timestamp.
> In case of pulseaudio pa_simple_drain (which waist until whole buffer is
> played) can be used when discontinuity is detected.
> 

> Regarding synthesizing monotonic timestamps ffmpeg does it itself, so
> application may just do nothing, but it is not easy by application to
> determine current position in audio stream. Imagine you have 1sec buffer
> and you do seek every 0,1sec. Determining current position in stream is
> quite hard.

iam not sure its easier if you pass timestamps through unchanged

consider mpeg-ps, mpeg-ts or ogg these all allow timestamp
discontinuities so knowing timestamp 0 is displayed doesnt neccesarily
tell you which that is.
You could of course "remove" these discontinuities but then you
do almost the same as if you remove the discontinuities from seeks too

also with a seek every 0.1 sec, you would flush the not yet presented
frames before injecting new frames in the buffer so the buffer would
not hold much


a function like

av_get_currently_presented_frame(AVOutputFormat *s, AVFrame *out, int *time_delta_out)

that would give the user not just a timestamp but the whole currently
presented AVFrame (or AVPacket) could give you actual timestamp in
ether API, byte position in file, and all the metadata/side data
thats in it (might be usefull to display something like the currently
played artist / song title)

also a function like av_get_currently_presented_frame() could be
implemented in generic code requiring no changed in output devices
just information about the current latency of the device



> 
> I skipped remarks posted by Michael, they are valuable, but doesn't regard
> this commit directly.
> If we had behavior described by Michael then patch would be wrong, but in
> current state it makes things simpler.
> 
> If you don't agree to merge then I just keep this patch locally.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20140108/df9ac952/attachment.asc>


More information about the ffmpeg-devel mailing list