summaryrefslogtreecommitdiff
path: root/src/lib/j2k_encoder.cc
AgeCommit message (Collapse)Author
2024-12-24Replace assertion with a softer fix.Carl Hetherington
Had a report of this assertion tripping with "only servers encode" switched on. The user had encode servers but they were running old software, so wouldn't be enabled for use. Obviously the main DCP-o-matic should not crash in this situation.
2024-12-24Log things used to decide on thread counts.Carl Hetherington
2024-12-18Fix hang when encoding with GPU enabled but not working.Carl Hetherington
2024-12-09Assert if we're about to set up 0 encoding threads.Carl Hetherington
2024-11-29Abort encode if Grok encoder threads are failing (#2899)Carl Hetherington
2024-05-08Merge remote-tracking branch 'origin/main' into v2.17.xCarl Hetherington
2024-05-08Work around deadlock when destroying J2KEncoder with a full writer queue ↵v2.16.83Carl Hetherington
(#2784). This feels like a hack, but I can't think of a nicer way to do it. The interruption disable makes sense because when we destroy encoder threads during a DCP encode (because a remote server goes away, for example) we don't want any frames to be lost due to the encode thread being interrupted between taking the frame off the queue and sending it to the writer. When we're destroying the encoder we don't care about this, but I can't see how you'd differentiate. Maybe the encoder queue could have two lists: to-do and in-progress; the encoder thread atomically moves a frame from to-do to in-progress, but then how do you know when the in-progress ones are orphaned and need to be re-added to the main queue. You could make the writer return saying "no" if the queue is full (rather than blocking and waiting for the queue to empty) but that seems wasteful as then the frame would be re-encoded.
2024-04-22Allow specification of video bit rate separately for J2K and MPEG2.Carl Hetherington
2024-04-21Rename j2k_bandwidth -> video_bit_rate.Carl Hetherington
2024-04-21Extract VideoEncoder as a parent of J2KEncoder.Carl Hetherington
2024-01-28Swap a log for a more informative one.Carl Hetherington
2024-01-28Clean up grok's presence in the config file and make sure it's optional.Carl Hetherington
It should be allowed to not have any grok stuff in the config file, and we should generally call it grok rather than GPU in case other non-grok GPU stuff arrives in the future.
2024-01-28Another patch from Aaron.Carl Hetherington
2024-01-28Forward-declare grk_plugin stuff.Carl Hetherington
2024-01-28Create a single DcpomaticContext for all GrokContexts, rather than copying them.Carl Hetherington
I think this makes sense, and also allows us to forward-declare the contexts in a forthcoming commit.
2024-01-28Only build grok for Ubuntu 22.04.Carl Hetherington
2024-01-28Explicitly set up Grok logger rather than relying on a static variable.Carl Hetherington
2024-01-28Rearrange encoder threading.Carl Hetherington
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.
2024-01-28Remove check for _threads being null, as I think it should not happen.Carl Hetherington
2024-01-28Cleanup: white space.Carl Hetherington
2024-01-28Cleanup: white space tidying.Carl Hetherington
2024-01-28Change end() to only do one thing, and copy the required stuff into pause()Carl Hetherington
2024-01-28Formatting, variable name tidying and some const correctness.Carl Hetherington
2024-01-28Patch from Aaron Boxer adding initial support for GPU-powered J2K encoding ↵Carl Hetherington
via his tool "grok".
2023-11-23Update servers list after connecting to the signal.Carl Hetherington
Otherwise it can happen that a signal is emitted before we connect to it, and then after that no more signals come because nothing changes.
2022-10-17Remove some unnecessary use of shared_ptr.Carl Hetherington
2022-09-27Use EnumIndexedVector in J2KEncoder.Carl Hetherington
2022-09-10Trim some includes.Carl Hetherington
2022-07-15Fix failure to destroy the J2KEncoder when an encode fails/is cancelled.Carl Hetherington
2022-05-02It doesn't seem necessary to use shared_ptr for the DCPVideo queue in ↵v2.16.x-oldCarl Hetherington
J2KEncoder.
2022-04-03C++11 and whitespace cleanups.Carl Hetherington
2021-04-21Add some possibly-useful markers for debugging threads from coredumps.Carl Hetherington
2021-04-08Assorted C++11/formatting cleanups.Carl Hetherington
2021-01-31More enum class additions.Carl Hetherington
2021-01-11More c++ tidying.Carl Hetherington
2021-01-07BOOST_FOREACH.Carl Hetherington
2021-01-07std::shared_ptrCarl Hetherington
2020-12-05Fix transcode finish time estimations when re-encoding a DCP (#1863).Carl Hetherington
2020-11-26It feels unsafe not to lock _threads_mutex between terminate_threads()Carl Hetherington
and _threads.reset(); move the lock.
2020-11-04Re-add mutex that was taken away inCarl Hetherington
73ebb92e9df01ba7afb97121b6e2cef6ca13a18e I'm not sure why it was removed, and it seems necessary; servers_list_changed() can be called from a variety of different places (the constructor and two different EncodeServerFinder threads). May help with #1854.
2020-11-02Pass around JPEG2000 data as a shared_ptr and hence avoid a copyCarl Hetherington
of 4MB of data for every JPEG2000 frame we decode.
2020-09-12Remove support for Windows XP.Carl Hetherington
2020-07-29Fix bugs in thread termination causing occasional pthreadCarl Hetherington
assertion failures. Before this, it was possible for J2KEncoder::terminate_threads() to finish without terminating all threads if the thread _running_ terminate_threads() was itself interrupt()ed. This is because the thread_group::join_all() in terminate_threads() is an interruption point, so it was possible it not to complete but instead to throw interrupted_exception. Then the owning J2KEncoder would be torn down but the threads would still be running, causing use-after-frees. This commit adds some boost::this_thread::disable_interruption objects to ensure that the owning thread is not interrupted while it is being destroyed. Also tidy up code that does this stuff, assuming that it's safe to not call thread::joinable but instead do thread.interrupt(); try { thread.join(); } catch (...) {}
2020-07-26Various OSX warnings fixes.Carl Hetherington
2020-07-23Use thread_group for improved exception safety (#1785).Carl Hetherington
2020-04-14Try to give a better error when we fail to start J2K encodingCarl Hetherington
(probably because of a lack of addressable RAM). See #1540.
2020-02-19Can't put boost::thread in a std::list with our macOS compiler.Carl Hetherington
2020-01-30Various thread cleanups.Carl Hetherington
2019-12-11Make terminate_threads() less likely to leave _threads containing invalid ↵Carl Hetherington
pointers. Backported from f0c10e92b849566e458bc323f8783a6fe83e52d2 in master.
2019-11-30Don't say we're encoding at 0fps when we're waiting for the timing history ↵Carl Hetherington
to stablise.