GNOME Bugzilla – Bug 351659
[wavpackparse] fix resync in push mode, implement it in pull mode
Last modified: 2006-08-18 21:40:25 UTC
Hi, the attached patch fixes resync in push mode (g_strstr_len() doesn't look at the complete length but stops at \0) and implements it in pull mode. Additionally the get_upstream_length() function uses query_peer_duration() instead of getting the peer itself, etc... Bye
Created attachment 71034 [details] [review] wavpackparse-1.diff
Oh, and it fixes event handling... pushing EOS and friends upstream again is not the best thing we can do ;)
Created attachment 71035 [details] [review] wavpackparse-1.diff fixed indention
- gst_wavpack_parse_find_marker(): add guard against size < 4 - gst_wavpack_parse_resync_loop(): the sync logic isn't really safe: both times where you call gst_wavpack_read_header() you can't know/ haven't checked that there is actually sizeof(WavpackHeader) data, so there are potential crashers here if you reach the end of the file and the len is < sizeof(WavpackHeader) or if there's a sync marker towards the end of the buffer without sizeof(WavpackHeader) data left. - also gst_wavpack_parse_resync_loop(): return flow return as return value, and initialize local variable to UNEXPECTED (*flow_ret was never set to anything if it bailed out right away, so the loop function would have checked an uninitialized flow value, no?) - s/wavpackparse/parse/ as variable name at least for new functions (makes code easier to read since lines are shorter and wrapped less often) Committed with changes (let me know if the changes broke anything): 2006-08-18 Tim-Philipp Müller <tim at centricular dot net> Based on patch by: Sebastian Dröge <slomo at circular-chaos.org> * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_sink_event), (gst_wavpack_parse_get_upstream_length), (gst_wavpack_parse_find_marker), (gst_wavpack_parse_resync_loop), (gst_wavpack_parse_loop), (gst_wavpack_parse_resync_adapter): Fix resyncing in push mode not stopping re-syncing at embedded zeroes; skip garbage between frames in pull mode as well if necessary; use gst_pad_query_peer_duration(); push EOS and NEWSEGMENT event in right direction (#351659).