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)
_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

index 7bd7ddf68da2c00d14f3620160d055f78ebd21c1..7af89e84d074b3c791032b96327465068b645e11 100644 (file)
@@ -415,3 +415,9 @@ DCPDecoder::set_forced_reduction (optional<int> reduction)
 {
        _forced_reduction = reduction;
 }
+
+ContentTime
+DCPDecoder::position () const
+{
+       return ContentTime::from_frames(_offset, _dcp_content->active_video_frame_rate(film())) + _next;
+}
index 4068696eafe397620b824d3665a0f0e9e541752d..7beb7f7b167be6bfa85bbae212a270787ee833aa 100644 (file)
@@ -52,6 +52,8 @@ public:
        bool pass ();
        void seek (ContentTime t, bool accurate);
 
+       ContentTime position () const;
+
 private:
        friend struct dcp_subtitle_within_dcp_test;
 
index d610f8727c902cd6bf889ab8cbc024ba3981f606..93c212b344c97c2b9277e4be45a6a2d0d8209115 100644 (file)
@@ -57,7 +57,7 @@ public:
        virtual bool pass () = 0;
        virtual void seek (ContentTime time, bool accurate);
 
-       ContentTime position () const;
+       virtual ContentTime position () const;
 
 protected:
        boost::shared_ptr<const Film> film () const;