Commit graph

561 commits

Author SHA1 Message Date
Vincent Penquerc'h
b4d6263f38 oggdemux: fix granpos interpolation violating max keyframe distance
In case many packets fit on a page, we may not see a granpos for
a while, and granpos interpolation can wrap the 'frames since last
keyframe' part of the granpos, generating a granpos which is smaller
than what it should be.

This is fixed by detecting keyframe packets (at least for Theora),
and updating the last keyframe granpos from this.

This may still be generating potentially wrong granpos for streams
which have a Theora like granpos (keyframes, a max keyframe distance
and a count of frames since last keyframe), and which allow implicit
granules on packets. For these streams, a custom keyframe detection
routine should be plugged into their GstOggStream mapper.

https://bugzilla.gnome.org/show_bug.cgi?id=669164
2012-02-02 13:06:29 +00:00
Mark Nauwelaerts
34d767c6a8 oggstream: initialize variable
... to help out challenged compiler.
2012-01-17 18:19:30 +01:00
Vincent Penquerc'h
9f4b71b2a7 oggdemux: fix push mode chain leak
When I first implemented push mode seeking, I removed the chain
freeing there as it could be used later. The current code does not
seem to do that though, so I'm restoring the previous freeing,
which plugs the leak while apparently not reintroducing use of
freed data with chained and normal files, both with gst-launch
playbin2 and Totem.
2012-01-11 16:17:42 +00:00
Vincent Penquerc'h
83c9396850 Revert "oggmux: fix pad leak"
This reverts commit 5df30c1b90.

I must have dreamt the Valgrind logs, reverting this reintroduces
no leak, and gets rid of the test failures it introduced :S
2012-01-10 19:02:31 +00:00
Vincent Penquerc'h
35df9d2ad9 oggstream: fix tag list leak 2012-01-10 16:57:04 +00:00
Vincent Penquerc'h
a718b859a7 oggdemux: fix pad leak 2012-01-10 16:51:09 +00:00
Vincent Penquerc'h
ef1469fc8b oggdemux: fix hang on small truncated files
A first hang was happening when trying to locate a page backwards,
where we'd sync forever on the same page.
With that fixed, a second hang would happen after preparing an EOS
event, but with no chain created yet to send it to, the pipeline
would stay idle forever.
An element error is now emitted for this case.
2012-01-10 16:20:23 +00:00
Vincent Penquerc'h
5df30c1b90 oggmux: fix pad leak 2012-01-10 16:20:23 +00:00
Thiago Santos
08022bddc8 oggmux: fix leak when initializing pads
Pads are initialized twice: when requesting pads and when
initializing collectpads. Avoid double initialization by
checking if collectpads are still going to be initialized when
creating request pads.
2011-12-28 09:45:53 -03:00
Vincent Penquerc'h
229377fb6b oggdemux: assume live stream if byte size cannot be determined
This prevents trying to seek and failing, then ending up unable
to stream because we can't get back at the headers.
A more robust way would be to find a good place to reinject the
headers when a seek fails, but I can't seem to get this to work.
2011-12-16 15:29:21 +00:00
Tim-Philipp Müller
5440ae3c18 Suppress deprecation warnings in selected files, for g_static_rec_mutex_* mostly
GStaticRecMutex is part of our API/ABI, not much we can do here
in 0.10 for most of these.
2011-12-04 20:50:25 +00:00
Tim-Philipp Müller
0d98aa25b8 Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We'll change these
over to the new API once we depend on glib >= 2.32.

Replace g_thread_create() with g_thread_try_new().
2011-12-04 17:16:30 +00:00
Piotr Fusik
14644457b0 various: typo fixes
Fix typos in code and docs. Fixes. #658984
2011-12-02 12:03:27 +01:00
Alessandro Decina
ab921eec11 oggdemux: fix compiler warning 2011-11-29 09:16:20 +01:00
Vincent Penquerc'h
96374054ac various: fix pad template leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:09:02 +00:00
Vincent Penquerc'h
c6b9145630 oggmux: set collectpads2 not to wait on sparse streams
https://bugzilla.gnome.org/show_bug.cgi?id=663174
2011-11-25 16:11:01 +00:00
Vincent Penquerc'h
a5c64d5b97 oggdemux: minor cleanup 2011-11-24 17:12:56 +00:00
Vincent Penquerc'h
b0bb1d3539 oggdemux: skip the second bisection when possible
If we already saw the keyframes that we need to find,
we do not need to bisect to find them.

This will always be the case for streams with audio only,
where each frame acts as a keyframe, but will occasionally
also happen for streams with video.

https://bugzilla.gnome.org/show_bug.cgi?id=662475
2011-11-24 10:48:48 +01:00
Vincent Penquerc'h
e7079cd8d5 oggdemux: improve push time seeking
Various tweaks to improve convergence, in particular for
the worst case, which is now cut in about half.

https://bugzilla.gnome.org/show_bug.cgi?id=662475
2011-11-24 10:48:32 +01:00
Vincent Penquerc'h
db21375406 oggdemux: gather some more stats about bisection
https://bugzilla.gnome.org/show_bug.cgi?id=662475
2011-11-24 10:48:15 +01:00
Vincent Penquerc'h
042b4f9a29 oggstream: extract opus comments if available 2011-11-22 13:29:10 +00:00
Vincent Penquerc'h
bf73491077 oggstream: recognize opus headers from data, not packet count
Opus streams outside of Ogg may not have headers, and oggstream
may be used by oggmux to mux an Opus stream which does not come
from Ogg - thus without headers.
Determining headerness by packet count would strip the first two
packets from such an Opus stream, leading to a very small amount
of audio being clipped at the beginning of the stream.
2011-11-22 13:15:33 +00:00
Vincent Penquerc'h
9d4989395c oggdemux: add some more debug info when determining start time 2011-11-22 13:01:35 +00:00
Vincent Penquerc'h
2a87d7c8ce oggstream: fix opus duration calculation 2011-11-22 12:55:56 +00:00
Vincent Penquerc'h
ceee36195a oggstream: early out on headers when determining packet duration 2011-11-22 12:00:58 +00:00
Vincent Penquerc'h
e05f1df04b oggstream: account for opus pre-skip in granpos/time mapping 2011-11-22 11:59:54 +00:00
Vincent Penquerc'h
9d2a2750c2 ogg: add opus support 2011-11-19 16:06:09 +00:00
Vincent Penquerc'h
353153d079 oggdemux: survive skeleton finding length behind our backs in push mode
In push mode, we determine duration by doing a seek to the end of the
stream. However, a skeleton stream with an index will cause the duration
to be known already, and we end up never setting the push_time_duration
variable which we use to know duration has been determined.

https://bugzilla.gnome.org/show_bug.cgi?id=662049
2011-11-07 12:20:16 +00:00
Sebastian Dröge
41dc3033d4 oggmux: Remove obsolete #include 2011-11-03 09:27:56 +01:00
Thiago Santos
136f5b2690 oggmux: port to gstcollectpads2 2011-10-28 10:06:16 +02:00
René Stadler
133a0b1771 oggdemux: remove avoidable call to gst_object_set_name 2011-10-21 22:24:14 +02:00
Vincent Penquerc'h
26e1c2d628 oggdemux: do not retry seeking indefinitely
https://bugzilla.gnome.org/show_bug.cgi?id=661897
2011-10-17 10:51:19 +01:00
Vincent Penquerc'h
c956c5fd00 oggstream: only use information from skeleton if we have nothing better
The codec setup headers are a lot more likely to have correct information,
especially as it's easy to remux a skeleton in a file where streams don't
have the same parameters (I've even seen a file with two skeletons).

Still, this is useful in the case we have a codec we can't decode, so we
can at least (theoretically) convert granpos to time, so we discard this
information if the codec setup has already provided it.

This fixes playback on (at lesat) the original archive.org encoding of
"The Night of the Living Dead" (now replaced by another encoding).

https://bugzilla.gnome.org/show_bug.cgi?id=612443
2011-09-19 23:21:23 +01:00
Tim-Philipp Müller
15d8082a55 oggdemux: remove superfluous check in newsegment event handler
If we get a newsegment event from upstream, we can be quite
sure we're not operating pull-based.
2011-09-16 20:14:39 +01:00
Tim-Philipp Müller
049e275632 oggdemux: minor printf format fix 2011-09-16 20:11:56 +01:00
Vincent Penquerc'h
89fc5b4bd8 oggdemux: fix wedge when seeking twice quickly in push mode
This could happen when testing with navseek, and pressing
right and left at roughly the same time. The current chain
is temporarily moved away, and this caused the flush events
not to be sent to the source pads, which would cause the
data queues downstream to reject incoming data after the
seek, and shut down, wedging the pipeline.

Now, I can't really decide whether this is a nasty steaming
hack or a good fix, but it certainly does fix the issue, and
does not seem to break anything else so far.

https://bugzilla.gnome.org/show_bug.cgi?id=621897
2011-09-16 20:07:33 +01:00
Vincent Penquerc'h
0173afa38c oggdemux: implement push mode seeking
This patch implements seeking in push mode (eg, over the net)
in Ogg, using the double bisection method.
As a side effect, it also fixes duration determination of network
streams, by seeking to the end to check the actual duration.

Known issues:
- Getting an EOS while seeking stops the streaming task, I can't
  find a way to prevent this (eg, by issuing a seek in the event
  handler).
- Seeking twice in a VERY short succession with playbin2 fails
  for streams with subtitles, we end up pushing in a dataqueue
  which is flushing. Rare in normal use AFAICT.
- Seeking is slow on slow links - byte ranges guesses could be
  made better, decreasing the number of required requests
- If no granule position is found in the last 64 KB of a stream,
  duration will be left unknown (should be pretty rare)

https://bugzilla.gnome.org/show_bug.cgi?id=621897
2011-09-16 19:47:10 +01:00
Vincent Penquerc'h
6704b37fc3 oggdemux: do not propagate discontinuities in sparse streams
The first packet of a sparse stream may arrive after an initial
delay in the stream. If ogg_stream_packetout reports a discontinuity
in a sparse stream, do not propagate it to other streams in the
chain unnecessarily.

https://bugzilla.gnome.org/show_bug.cgi?id=621897
2011-09-14 23:20:01 +01:00
Vincent Penquerc'h
fd218c4ec2 oggmux: fix leaks in skeleton writing
https://bugzilla.gnome.org/show_bug.cgi?id=563251
2011-08-25 08:32:26 +02:00
Vincent Penquerc'h
29038283bc oggmux: generate message headers from received tags
Some message headers can be deduced from tags (eg, "Language").

https://bugzilla.gnome.org/show_bug.cgi?id=563251
2011-08-25 08:32:20 +02:00
Vincent Penquerc'h
53c8656248 ogg: use memory slices where appropriate
While there, avoid zeroing newly allocated memory where unnecessary

https://bugzilla.gnome.org/show_bug.cgi?id=656775
2011-08-25 08:26:49 +02:00
Vincent Penquerc'h
7b8b0fa1bb oggdemux: do not warn when reaching EOS while scanning for the end chain
After all, we were asking for it.

This gets rid of the last warning-about-expected-condition.

w00t.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:32:21 +02:00
Vincent Penquerc'h
df40ddf0aa oggdemux: add media type to chain information reports
One more little step in making logs a little less abstruse.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:31:58 +02:00
Vincent Penquerc'h
1e606c0456 oggstream: correctly identify skeleton EOS packet
It is 0 byte, and was triggering the "bad packet" logic.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:31:51 +02:00
Vincent Penquerc'h
68ed992e7e oggdemux: do not warn about expected occurences
In this case, finding a skeleton packet.
Once upon a time, it used to be rare indeed, but no more.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:31:30 +02:00
Vincent Penquerc'h
4fdb52871c oggdemux: do not warn when finding a non BOS page
After all, we do hope to find actual data for these streams.
However, warn if we could not set up a chain when we find a
non BOS page, as that means we don't have a valid Ogg stream.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:31:17 +02:00
Vincent Penquerc'h
564eedd214 oggdemux: rename local variable for clarity
While the casual reader might end up bewildered by just why this
change might increase clarity, it just happens than, in the libogg
and associated sources, op is the canonical name for an ogg_packet
whlie og is the canonical name for an ogg_page, and reading this
code confuses me.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:30:55 +02:00
Vincent Penquerc'h
5d18496a5b oggdemux: do not try to determine duration of header packets
Headers are inherently durationless.
Instead, set duration to 0 to avoid increasing tracked granpos,
and do not warn about it, since it is totally expected.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:30:45 +02:00
Vincent Penquerc'h
67a882afe7 oggstream: include stream type in warnings
It makes it easier to work out what's going on.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:30:30 +02:00
Vincent Penquerc'h
43cb76b1d8 oggstream: set skeleton stream media type to application/x-ogg-skeleton
This is to match the typefinder, and to make logs clearer.

https://bugzilla.gnome.org/show_bug.cgi?id=657151
2011-08-24 08:30:17 +02:00