Commit graph

35 commits

Author SHA1 Message Date
Wim Taymans
234d15c9d0 asf: unmap packets 2012-06-27 10:24:45 +02:00
Bastien Nocera
53cfef3e0f asfdemux: Ignore parsing errors from broken packets
We should instead be counting the number of errors and exiting if
they're too numerous. This makes a number of broken ASF files playable.

https://bugzilla.gnome.org/show_bug.cgi?id=678543

Conflicts:

	gst/asfdemux/asfpacket.c
	gst/asfdemux/gstasfdemux.c
2012-06-27 10:21:15 +02:00
Sebastian Dröge
452b3a29fc asfdemux: Use correct enum type 2012-05-13 15:26:48 +02:00
Tim-Philipp Müller
3064bf4a86 asfdemux: fix performance issue, especially with high-bitrate streams
Two things were suboptimal from a performance point of view:

a) consider a large media object such as a video keyframe, which
   may be split up into multiple fragments. We would assemble
   the media object as follows:
     buf = join (join (join (frag1, frag2), frag3), frag4)
   which causes many unnecessary memcpy()s, and malloc/free,
   which could easily add up to a multiple of the actual object
   size. To avoid this, we allocate a buffer of the size needed
   from the start and copy fragments into that directly.

b) for every fragment to join, we would create a sub-buffer
   before joining it (which would discard the sub-buffer again),
   leading to unnecessary miniobject create/free churn.

Conflicts:

	gst/asfdemux/asfpacket.c
	gst/asfdemux/asfpacket.h
2012-04-16 09:02:46 +02:00
Tim-Philipp Müller
65436c8715 asfdemux: avoid unnecessary stream lookup
We have already retrieved the stream for that stream number and
made sure it's not NULL, so no need to do it again here; neither
the number nor the streams changed since the last time.
2012-04-16 08:54:31 +02:00
Wim Taymans
ffa672bd34 update for buffer changes 2012-03-28 12:53:13 +02:00
Wim Taymans
56a07a14b5 port to new memory API 2012-01-25 11:57:07 +01:00
Mark Nauwelaerts
0bc76c0d03 asfpacket: fix 0.11 ported payload extraction
... to cater for not necessarily offset == size - cur_pos,
as size may have been adjusted due to padding.

Fixes #667567.
2012-01-13 15:59:01 +01:00
Wim Taymans
854f4d846b Merge branch 'master' into 0.11
Conflicts:
	ext/mad/gstmad.c
2011-09-26 19:07:23 +02:00
Mark Nauwelaerts
eee31aecb3 asfpacket: skip empty payload packets
... which also avoids assertion failures and possible segfaults later on
when possibly trying to join 2 empty buffers.
2011-09-08 17:02:27 +02:00
Edward Hervey
8281683027 asfdemux: Fix print statement 2011-08-02 12:40:01 +02:00
Thiago Santos
2dc2be5e7b asfdemux: Porting to 0.11 2011-06-20 00:36:59 -03:00
Edward Hervey
67f754a9ea asfpacket: Avoid using broken duration extension
Quite a few (broken?) files have a packet duration of 1ms, which is
most definitely wrong for either audio or video packets.

We therefore avoid using that value and instead use other metrics to
determine the buffer duration (like using the extended stream properties
average frame duration if present and valid).
2011-01-30 16:17:19 +01:00
Edward Hervey
f34dd3626a asfdemux: Make a table static to avoid having to always allocate it. 2010-04-14 09:30:54 +02:00
Edward Hervey
79b154e4f7 asfdemux: Make sure we always set proper payload duration.
Some (broken) streams will have a delta of 0, resulting in outgoing
buffers having durations of 0.

Fixes #611473
2010-03-01 16:51:56 +01:00
Edward Hervey
417e3e0346 asfdemux: Make sure we don't end up with negative timestamps.
Some files have payload with timestamps smaller than the preroll duration.
Instead of blindly substracting the preroll value (and ending up with
insanely high timestamps on the outgoing buffers), we make sure we
never go below 0.

Fixes #610432
2010-02-19 18:11:13 +01:00
Thiago Santos
8f60eb26f3 asfdemux: Do not subtract padding twice
Only subtract implicit padding if an explicit one isn't
provided. Avoids subtracting it twice and causing
parsing errors.

Fixes #607698
2010-01-22 15:49:58 -03:00
Michael Smith
2349f09e6a asfdemux: fix c99-style comments. 2009-10-29 11:39:13 -07:00
Michael Smith
5ccedb2a38 asfdemux: accept fragments in a continued packet where the subsequent fragments
declare a size of 0. Fixes bug 600037.
2009-10-29 10:36:08 -07:00
Thiago Santos
59f6c82c32 asfdemux: careful to avoid crash on bogus data
When receiving bogus data, we have to avoid subtracting a value
larger than 'size' from 'size' variable, resulting in a wrap
that would make 'size' a really large bogus value.

Fixes #599333
2009-10-26 17:31:19 -03:00
Edward Hervey
d71973cc4c asfdemux: Sprinkle branch prediction macros accross the code 2009-06-28 17:52:38 +02:00
Edward Hervey
f6f09cbb0a asfdemux: Downgrade simple statements from WARNING to DEBUG 2009-05-12 11:57:04 +02:00
Edward Hervey
61c00741a2 asf: Detect more payload extensions.
These should help fix interlaced/PAR issues with more files.
2009-05-12 11:53:45 +02:00
Mark Nauwelaerts
e8a6ad2546 asfdemux: use upstream segment and timestamps for some interpolation
This should particularly help in case of upstream live src, e.g. rtspsrc,
and especially so if it has to perform fallback to TCP.
2009-05-07 12:23:51 +02:00
Mark Nauwelaerts
8b2812ca2e asfdemux: 0-base timestamps consistently (whether or not streaming)
This also makes timestamps (more) consistent before and after a possible
seek, and moreover makes for reasonable position reporting in live stream
(whose payload timestamps should not be taken for granted).
2009-05-05 22:41:41 +02:00
Mark Nauwelaerts
44ebe58377 asfdemux: handle FIXME; normalize preroll 2009-05-05 22:41:33 +02:00
Edward Hervey
804f65e6db asfpacket: Fix pull-mode timestamping handling.
The problem that happens is the following:
* A packet with multiple payloads comes in
* Those payloads get handled one by one
* The first payload contains the first audio payload with timestamp A
* The second payload contains the first video (key)frame with timestamp V (where V < A)

With the previous code, the following would happen:
* the first payload gets processed, then passed to queue_for_stream
* queue_for_stream detects it's the first valid timestamp received and stores
  first_ts = A
* the second payload gets processed, then pass to queue_for_stream
* queue_for_stream detects the timestamp is lower than first_ts... and
  discards it... resulting in losing the first keyframe of the video stream

We've been having this issue for *ages*... it's just that nobody noticed it
that much with playbin. But with playbin2's aggresive multiqueue handling, this
will result in multiqueue not being able to preroll (because the video decoder will
be dropping a ton of buffers before (maybe) receiving the next keyframe).

Tested with over 200 asf files, and they all play the first frame correctly now,
even the most braindead ones.
2009-04-23 09:04:41 +02:00
Sebastian Dröge
2744324adc Remove redundant push_mode struct member 2009-01-30 14:38:23 +01:00
Hans de Goede
3bcd050fab Add seeking support to asfdemux in push mode
Fixes bug #568836.
2009-01-26 10:02:02 +01:00
Hans de Goede
4ff0d1fe52 Drop packets with an invalid replicated data length
Drop packets with an invalid replicated data length
instead of continuing with an invalid timestamp
and uninitialized payload metadata.
All other code assumes that the timestamps are valid.
2009-01-26 10:02:02 +01:00
Tim-Philipp Müller
f7abd8bbc8 gst/asfdemux/: Make all timestamps start from zero in pull-mode too; some small clean-ups and FIXMEs here and there.
Original commit message from CVS:
* gst/asfdemux/asfpacket.c: (gst_asf_payload_queue_for_stream):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_reset),
(gst_asf_demux_init), (gst_asf_demux_push_complete_payloads),
(gst_asf_demux_process_file):
* gst/asfdemux/gstasfdemux.h:
Make all timestamps start from zero in pull-mode too; some small
clean-ups and FIXMEs here and there.
2007-05-04 11:04:16 +00:00
Tim-Philipp Müller
c2784b4ca8 gst/asfdemux/asfpacket.c: If packet size is specified within the packet and smaller than the actual packet size, don'...
Original commit message from CVS:
* gst/asfdemux/asfpacket.c: (gst_asf_demux_parse_payload),
(gst_asf_demux_parse_packet):
If packet size is specified within the packet and smaller than
the actual packet size, don't parse beyond the size specified in
the packet (this makes us parse some cases of packets with single
compressed payloads cleanly, see e.g stream from #431318). Also
add a sanity check when parsing compressed single payloads.
2007-05-01 11:10:31 +00:00
Tim-Philipp Müller
279b2b0290 gst/asfdemux/: Seeking improvements: honour the KEY_UNIT seek flag; after a seek, only send data from the keyframe ri...
Original commit message from CVS:
* gst/asfdemux/asfpacket.c: (gst_asf_payload_queue_for_stream):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_seek_index_lookup),
(gst_asf_demux_handle_seek_event),
(gst_asf_demux_push_complete_payloads):
Seeking improvements: honour the KEY_UNIT seek flag; after a seek, only
send data from the keyframe right before the new segment start to
make sure the decoder doesn't have to decode more than absolutely
necessary.
2007-05-01 09:19:13 +00:00
Tim-Philipp Müller
b46ece6980 gst/asfdemux/: Implement payload extension system/extended replicated data parsing, so we can extract payload duratio...
Original commit message from CVS:
* gst/asfdemux/asfheaders.c:
* gst/asfdemux/asfheaders.h:
* gst/asfdemux/asfpacket.c:
(asf_payload_parse_replicated_data_extensions),
(gst_asf_demux_parse_payload):
* gst/asfdemux/asfpacket.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_free_stream),
(gst_asf_demux_push_complete_payloads),
(gst_asf_demux_process_ext_stream_props):
* gst/asfdemux/gstasfdemux.h:
Implement payload extension system/extended replicated data parsing,
so we can extract payload durations if they're specified.
2007-04-30 15:36:00 +00:00
Tim-Philipp Müller
6197c64106 gst/asfdemux/: New packet parsing code: should put halfway decent timestamps on buffers, and might even set the appro...
Original commit message from CVS:
* gst/asfdemux/Makefile.am:
* gst/asfdemux/asfpacket.c: (asf_packet_read_varlen_int),
(asf_packet_create_payload_buffer),
(asf_payload_find_previous_fragment),
(gst_asf_payload_queue_for_stream), (gst_asf_demux_parse_payload),
(gst_asf_demux_parse_packet):
* gst/asfdemux/asfpacket.h:
* gst/asfdemux/gstasfdemux.c:
(gst_asf_demux_reset_stream_state_after_discont),
(gst_asf_demux_push_complete_payloads), (gst_asf_demux_loop),
(gst_asf_demux_setup_pad), (gst_asf_demux_descramble_buffer),
(gst_asf_demux_process_chunk):
* gst/asfdemux/gstasfdemux.h:
New packet parsing code: should put halfway decent timestamps on
buffers, and might even set the appropriate keyframe/discont buffer
flags from time to time (and even if it doesn't, I'm at least able
to debug this code); only used in pull-mode so far. Still needs
some more work, like payload extensions parsing and proper flow
aggregation, and stream activation based on preroll. Stay tuned.
2007-04-20 20:57:56 +00:00