Give DCPDecoder its own ::position which just returns its internal v2.14.22
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Jan 2020 23:52:20 +0000 (23:52 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 9 Jan 2020 23:52:20 +0000 (23:52 +0000)
commit4285355ff2bec853924647f0523d121860fe64e3
tree7e9c97423136c8f58c67f0f6f33ec5fdf7824716
parente8582393bd1367fff36bae8e053d799073d8b2ed
Give DCPDecoder its own ::position which just returns its internal
_next time.

This is important because Decoder::position does the wrong thing
with DCPs in the following case.

1.  DCPDecoder emits a subtitle event (start/stop) at time t.
2.  There follows a long time T with no subtitle events.  During
    this time the DCPDecoder's position is reported as t (since
    TextDecoder notes its position as the time of the last thing
    it emitted --- which is all it reasonably can do, I think).
3.  During this T the DCPDecoder may be incorrectly pass()ed because
    its position is reported as earlier than it really is; this results
    in video/audio being emitted by the DCPDecoder but other contemporary
    sources may not be pass()ed.

The upshot of this can be that no audio is emitted, as a contemporary audio
source is not pass()ed and hence the merger is waiting for audio that will
take a long time to come.  When the butler is running this can result in
audio underruns as the video buffers overflow with no sign of any audio.

It is also simpler this way; DCPDecoder was already maintaining the required
information.
src/lib/dcp_decoder.cc
src/lib/dcp_decoder.h
src/lib/decoder.h