Codec frame delay fix and trailing zero-length frame fix
Takes codec frame delay into account (roughly the same way it does for timestamps for reordered frames) to produce frames with correct offsets. A special hack to allow trailing frame with timestamp=segment.stop to be displayed. Fixes bug #578278.