]> git.sesse.net Git - casparcg/commitdiff
2.1.0: -oal_consumer: Set thread priority to higher than normal.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 18 Mar 2012 19:34:52 +0000 (19:34 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 18 Mar 2012 19:34:52 +0000 (19:34 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2670 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/oal/consumer/oal_consumer.cpp

index 4cc1daf9c0e583784f9658c5ec1a41f020cce45e..c15455bb3284e4521fb2c5fc40adf4f850c4de81 100644 (file)
@@ -48,20 +48,21 @@ typedef std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>> audio_buffer
 \r
 struct oal_consumer : public core::frame_consumer,  public sf::SoundStream\r
 {\r
-       spl::shared_ptr<diagnostics::graph>                                             graph_;\r
+       spl::shared_ptr<diagnostics::graph>                                     graph_;\r
        boost::timer                                                                            perf_timer_;\r
        int                                                                                                     channel_index_;\r
 \r
        tbb::concurrent_bounded_queue<std::shared_ptr<audio_buffer_16>> input_;\r
        boost::circular_buffer<audio_buffer_16>                         container_;\r
        tbb::atomic<bool>                                                                       is_running_;\r
-       core::audio_buffer                                                                      temp;\r
+       bool                                                                                            set_thread_priority_;\r
 \r
        core::video_format_desc                                                         format_desc_;\r
 public:\r
        oal_consumer() \r
                : container_(16)\r
                , channel_index_(-1)\r
+               , set_thread_priority_(true)\r
        {\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
@@ -135,6 +136,12 @@ public:
        \r
        bool OnGetData(sf::SoundStream::Chunk& data) override\r
        {               \r
+               if(set_thread_priority_)\r
+               {\r
+                       SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);\r
+                       set_thread_priority_ = false;\r
+               }\r
+\r
                std::shared_ptr<audio_buffer_16> audio_data;            \r
                input_.pop(audio_data);\r
                                \r