summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-02-21 02:34:07 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-21 02:34:07 +0100
commite1fbf78fb369fe2788f4777dff7982b058a72b27 (patch)
tree98ab90ace24c48dff0e5f69aa1bd608d9379796f /src
parentc4d93c8f1d22124dd51b34655d8dc59687f2b9e3 (diff)
Cope with audio handling when no audio streams push.
This can happen when no audio is currently being offered.
Diffstat (limited to 'src')
-rw-r--r--src/lib/player.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index c6ef90395..9fd535c43 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -848,21 +848,23 @@ Player::pass()
if (latest_last_push_end != have_pushed.end()) {
LOG_DEBUG_PLAYER("PLY: Leading audio stream is in {} at {}", latest_last_push_end->second.piece->content->path(0).string(), to_string(latest_last_push_end->second.last_push_end.get()));
+ } else {
+ LOG_DEBUG_PLAYER("PLY: No audio stream has yet pushed");
+ }
- auto const ignore_threshold = dcpomatic::DCPTime::from_seconds(ignore_streams_behind);
- auto const leader_time = latest_last_push_end->second.last_push_end.get();
-
- /* Make a list of those streams that are less than ignore_threshold behind the leader.
- * If the leader has not yet reached ignore_threshold ahead of a stream's content position
- * we need to consider its not-yet-pushed streams as active, otherwise we might miss
- * something from them.
- */
- for (auto const& i: _stream_states) {
- if ((i.second.last_push_end && (leader_time - i.second.last_push_end.get()) < ignore_threshold) || ((leader_time - i.second.piece->content->position()) < ignore_threshold)) {
- alive_stream_states.insert(i);
- } else {
- LOG_DEBUG_PLAYER("PLY: Ignoring stream {} because it is too far behind", i.second.piece->content->path(0).string());
- }
+ auto const ignore_threshold = dcpomatic::DCPTime::from_seconds(ignore_streams_behind);
+ auto const leader_time = latest_last_push_end != have_pushed.end() ? latest_last_push_end->second.last_push_end.get() : DCPTime();
+
+ /* Make a list of those streams that are less than ignore_threshold behind the leader.
+ * If the leader has not yet reached ignore_threshold ahead of a stream's content position
+ * we need to consider its not-yet-pushed streams as active, otherwise we might miss
+ * something from them.
+ */
+ for (auto const& i: _stream_states) {
+ if ((i.second.last_push_end && (leader_time - i.second.last_push_end.get()) < ignore_threshold) || ((leader_time - i.second.piece->content->position()) < ignore_threshold)) {
+ alive_stream_states.insert(i);
+ } else {
+ LOG_DEBUG_PLAYER("PLY: Ignoring stream {} because it is too far behind", i.second.piece->content->path(0).string());
}
}