summaryrefslogtreecommitdiff
path: root/test/client_server_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-09-24 00:34:15 +0200
committerCarl Hetherington <cth@carlh.net>2024-01-28 02:01:57 +0100
commitf8d0dac871883c7cbfa6f31c182ca3e6d213aed1 (patch)
tree6bc2c82776d66380382cbfb76940463c950f4b6e /test/client_server_test.cc
parent25dd85d10a05b363f5f6a94d6dafbf4aed47c4ac (diff)
Rearrange encoder threading.
Soon we'll add a new encoder type, and the existing structure was already creaking a bit at the seams while handling local and remote encodes. Here we split out an encoder thread and introduce the concept of a "sync" thread (which blocks while the encoding is happening). Later we'll have another type which submits the encode request to a GPU and receives the reply back later.
Diffstat (limited to 'test/client_server_test.cc')
-rw-r--r--test/client_server_test.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/test/client_server_test.cc b/test/client_server_test.cc
index 4f5015fc8..1bfa4c5a6 100644
--- a/test/client_server_test.cc
+++ b/test/client_server_test.cc
@@ -20,20 +20,18 @@
/** @file test/client_server_test.cc
- * @brief Test the server class.
+ * @brief Test the remote encoding code.
* @ingroup feature
- *
- * Create a test image and then encode it using the standard mechanism
- * and also using a EncodeServer object running on localhost. Compare the resulting
- * encoded data to check that they are the same.
*/
+#include "lib/content_factory.h"
#include "lib/cross.h"
#include "lib/dcp_video.h"
#include "lib/dcpomatic_log.h"
#include "lib/encode_server.h"
#include "lib/encode_server_description.h"
+#include "lib/encode_server_finder.h"
#include "lib/file_log.h"
#include "lib/image.h"
#include "lib/j2k_image_proxy.h"
@@ -316,3 +314,22 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
}
+BOOST_AUTO_TEST_CASE(real_encode_with_server)
+{
+ auto content = content_factory(TestPaths::private_data() / "dolby_aurora.vob");
+ auto film = new_test_film2("real_encode_with_server", content);
+
+ EncodeServerFinder::instance();
+
+ EncodeServer server(true, 4);
+ thread server_thread(boost::bind(&EncodeServer::run, &server));
+
+ make_and_verify_dcp(film);
+
+ server.stop();
+ server_thread.join();
+
+ BOOST_CHECK(server.frames_encoded() > 0);
+ EncodeServerFinder::drop();
+}
+