]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Remove some random unneeded memory allocations.
[nageru] / mixer.cpp
index f1d116fe497bdeb0e6f020aef2a7b468624ede2a..f502eb0e4590c86092588841bd04298e1f4f4600 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -353,7 +353,7 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        theme.reset(new Theme(global_flags.theme_filename, global_flags.theme_dirs, resource_pool.get(), num_cards));
 
        // Start listening for clients only once VideoEncoder has written its header, if any.
-       httpd.start(9095);
+       httpd.start(global_flags.http_port);
 
        // First try initializing the then PCI devices, then USB, then
        // fill up with fake cards until we have the desired number of cards.
@@ -371,7 +371,10 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
 
                                DeckLinkCapture *capture = new DeckLinkCapture(decklink, card_index);
                                DeckLinkOutput *output = new DeckLinkOutput(resource_pool.get(), decklink_output_surface, global_flags.width, global_flags.height, card_index);
-                               output->set_device(decklink);
+                               if (!output->set_device(decklink)) {
+                                       delete output;
+                                       output = nullptr;
+                               }
                                configure_card(card_index, capture, CardType::LIVE_CARD, output);
                                ++num_pci_devices;
                        }
@@ -1393,10 +1396,10 @@ void Mixer::render_one_frame(int64_t duration)
        for (int i = 1; i < theme->get_num_channels() + 2; ++i) {
                DisplayFrame display_frame;
                Theme::Chain chain = theme->get_chain(i, pts(), global_flags.width, global_flags.height, input_state);  // FIXME: dimensions
-               display_frame.chain = chain.chain;
-               display_frame.setup_chain = chain.setup_chain;
+               display_frame.chain = move(chain.chain);
+               display_frame.setup_chain = move(chain.setup_chain);
                display_frame.ready_fence = fence;
-               display_frame.input_frames = chain.input_frames;
+               display_frame.input_frames = move(chain.input_frames);
                display_frame.temp_textures = {};
                output_channel[i].output_frame(display_frame);
        }
@@ -1527,7 +1530,7 @@ void Mixer::OutputChannel::output_frame(DisplayFrame frame)
                if (has_ready_frame) {
                        parent->release_display_frame(&ready_frame);
                }
-               ready_frame = frame;
+               ready_frame = move(frame);
                has_ready_frame = true;
 
                // Call the callbacks under the mutex (they should be short),
@@ -1590,7 +1593,7 @@ bool Mixer::OutputChannel::get_display_frame(DisplayFrame *frame)
        }
        if (has_ready_frame) {
                assert(!has_current_frame);
-               current_frame = ready_frame;
+               current_frame = move(ready_frame);
                ready_frame.ready_fence.reset();  // Drop the refcount.
                ready_frame.input_frames.clear();  // Drop the refcounts.
                has_current_frame = true;