Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/encode_server_finder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ EncodeServerFinder* EncodeServerFinder::_instance = 0;
EncodeServerFinder::EncodeServerFinder()
: _stop(false)
{
Config::instance()->Changed.connect(boost::bind(&EncodeServerFinder::config_changed, this, _1));
_config_changed_connection = Config::instance()->Changed.connect(boost::bind(&EncodeServerFinder::config_changed, this, _1));
}


Expand Down
3 changes: 3 additions & 0 deletions src/lib/encode_server_finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@ class EncodeServerFinder : public Signaller, public ExceptionStore

std::shared_ptr<Socket> _accept_socket;

/** Last, so that it is disconnected before anything else is destroyed */
boost::signals2::scoped_connection _config_changed_connection;

static EncodeServerFinder* _instance;
};
19 changes: 6 additions & 13 deletions src/lib/ffmpeg_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -655,21 +655,14 @@ FFmpegContent::add_properties(shared_ptr<const Film> film, list<UserProperty>& p
_("SMPTE 2085, Y'D'zD'x"),
_("Chroma-derived non-constant luminance"),
_("Chroma-derived constant luminance"),
#ifdef DCPOMATIC_FFMPEG_8
_("BT2100"),
_("SMPTE ST 2128, IPT-C2"),
_("YCgCo-R, even addition"),
_("YCgCo-R, odd addition")
#else
_("BT2100")
#endif
_("BT2100"),
/* These three are in FFmpeg 7.1 and later */
_("SMPTE ST 2128, IPT-C2"),
_("YCgCo-R, even addition"),
_("YCgCo-R, odd addition")
};

#ifdef DCPOMATIC_FFMPEG_8
DCPOMATIC_ASSERT(AVCOL_SPC_NB == 18);
#else
DCPOMATIC_ASSERT(AVCOL_SPC_NB == 15);
#endif
DCPOMATIC_ASSERT(AVCOL_SPC_NB <= 18);

p.push_back(UserProperty(UserProperty::VIDEO, _("Colourspace"), spaces[_colorspace.get_value_or(AVCOL_SPC_UNSPECIFIED)]));

Expand Down
2 changes: 1 addition & 1 deletion test/audio_analysis_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(audio_analysis_serialisation_test)
int const points = 4096;

auto random_float = []() {
return (float(rand()) / RAND_MAX) * 2 - 1;
return (float(rand()) / static_cast<float>(RAND_MAX)) * 2 - 1;
};

AudioAnalysis a(3);
Expand Down
2 changes: 1 addition & 1 deletion test/audio_buffers_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static float tolerance = 1e-3;
static float
random_float ()
{
return float (rand ()) / RAND_MAX;
return float (rand ()) / static_cast<float>(RAND_MAX);
}

static void
Expand Down
43 changes: 43 additions & 0 deletions test/butler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,49 @@ BOOST_AUTO_TEST_CASE (butler_test1)
}


/** The Butler limits the peaks of its mapped audio, so a mapping that adds up to more than full scale cannot clip */
BOOST_AUTO_TEST_CASE(butler_limits_peaks_test)
{
auto video = content_factory("test/data/flat_red.png")[0];
auto audio = content_factory("test/data/staircase.wav")[0];
auto film = new_test_film("butler_limits_peaks_test", { video, audio });
film->set_audio_channels(6);

/* The staircase is on the centre channel; send it to both outputs far too loud */
auto map = AudioMapping(6, 2);
map.set(dcp::Channel::CENTRE, 0, 1000);
map.set(dcp::Channel::CENTRE, 1, 1000);

Player player(film, Image::Alignment::COMPACT, false);

Butler butler(
film,
player,
map,
2,
AV_PIX_FMT_RGB24,
VideoRange::FULL,
Image::Alignment::COMPACT,
false,
false,
Butler::Video::ENABLED,
Butler::Audio::ENABLED
);

butler.get_video(Butler::Behaviour::BLOCKING, 0);

float buffer[2048 * 2];
BOOST_REQUIRE(butler.get_audio(Butler::Behaviour::BLOCKING, buffer, 2048) == DCPTime());
float peak = 0;
for (auto sample: buffer) {
peak = std::max(peak, std::fabs(sample));
}
/* Without the limiter the staircase would reach 1000 * 2047 / 32768, about 62 */
BOOST_CHECK(peak <= 1.0f + 1e-6f);
BOOST_CHECK(peak > 0.5f);
}


BOOST_AUTO_TEST_CASE (butler_test2)
{
auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv");
Expand Down
25 changes: 25 additions & 0 deletions test/client_server_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ BOOST_AUTO_TEST_CASE(real_encode_with_server)
auto film = new_test_film("real_encode_with_server", content, &cl);
film->set_interop(false);

/* Ask the server on this machine directly rather than broadcasting, as a broadcast may not
* be allowed (e.g. in a sandbox or on a machine without a network).
*/
auto const use_any_servers = Config::instance()->use_any_servers();
auto const servers = Config::instance()->servers();
Config::instance()->set_use_any_servers(false);
Config::instance()->set_servers({"127.0.0.1"});

EncodeServerFinder::instance();

EncodeServer server(true, 4);
Expand All @@ -336,8 +344,25 @@ BOOST_AUTO_TEST_CASE(real_encode_with_server)
server_thread.join();

BOOST_CHECK(server.frames_encoded() > 0);

Config::instance()->set_use_any_servers(use_any_servers);
Config::instance()->set_servers(servers);

EncodeServerFinder::drop();

cl.run();
}


/** A configuration change after the finder has been dropped must not reach the deleted finder */
BOOST_AUTO_TEST_CASE(encode_server_finder_dropped_before_config_change)
{
auto const servers = Config::instance()->servers();

EncodeServerFinder::instance();
EncodeServerFinder::drop();

Config::instance()->set_servers({"127.0.0.1"});
Config::instance()->set_servers(servers);
}

Loading
Loading