]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: - Hard-coded consumer buffer depth to 7.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 3 Jun 2011 13:12:25 +0000 (13:12 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 3 Jun 2011 13:12:25 +0000 (13:12 +0000)
         - Some function renaming.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@842 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

20 files changed:
common/concurrency/executor.h
core/consumer/frame_consumer.h
core/consumer/frame_consumer_device.cpp
core/consumer/frame_consumer_device.h
core/mixer/frame_mixer_device.cpp
core/mixer/frame_mixer_device.h
core/mixer/gpu/ogl_device.h
core/mixer/read_frame.cpp
core/mixer/read_frame.h
core/producer/frame_producer_device.cpp
core/producer/frame_producer_device.h
core/video_channel.cpp
core/video_channel_context.h
modules/bluefish/consumer/bluefish_consumer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.h
modules/ffmpeg/ffmpeg.cpp
modules/ffmpeg/ffmpeg.vcxproj
modules/oal/consumer/oal_consumer.cpp
shell/server.cpp

index 2caf5c705f65e2c8c18a6dae82da5b7aa770c5b8..45c452f261348e8922b6e346b8d757ec5c443115 100644 (file)
@@ -61,14 +61,14 @@ inline void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
 \r
 }\r
 \r
-enum priority\r
+enum task_priority\r
 {\r
        high_priority,\r
        normal_priority,\r
        priority_count\r
 };\r
 \r
-enum priority_class\r
+enum thread_priority\r
 {\r
        high_priority_class,\r
        above_normal_priority_class,\r
@@ -141,7 +141,7 @@ public:
                execution_queue_[normal_priority].set_capacity(capacity);\r
        }\r
 \r
-       void set_priority_class(priority_class p)\r
+       void set_priority_class(thread_priority p)\r
        {\r
                begin_invoke([=]\r
                {\r
@@ -174,7 +174,7 @@ public:
        }\r
                                \r
        template<typename Func>\r
-       auto begin_invoke(Func&& func, priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
+       auto begin_invoke(Func&& func, task_priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
        {       \r
                // Create a move on copy adaptor to avoid copying the functor into the queue, tbb::concurrent_queue does not support move semantics.\r
                auto task_adaptor = internal::make_move_on_copy(create_task(func));\r
@@ -195,7 +195,7 @@ public:
        }\r
 \r
        template<typename Func>\r
-       auto try_begin_invoke(Func&& func, priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
+       auto try_begin_invoke(Func&& func, task_priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
        {\r
                // Create a move on copy adaptor to avoid copying the functor into the queue, tbb::concurrent_queue does not support move semantics.\r
                auto task_adaptor = internal::make_move_on_copy(create_task(func));\r
@@ -220,7 +220,7 @@ public:
        }\r
 \r
        template<typename Func>\r
-       auto invoke(Func&& func, priority prioriy = normal_priority) -> decltype(func()) // noexcept\r
+       auto invoke(Func&& func, task_priority prioriy = normal_priority) -> decltype(func()) // noexcept\r
        {\r
                if(boost::this_thread::get_id() == thread_.get_id())  // Avoids potential deadlock.\r
                        return func();\r
@@ -229,7 +229,7 @@ public:
        }\r
 \r
        template<typename Func>\r
-       auto try_invoke(Func&& func, priority prioriy = normal_priority) -> decltype(func()) // noexcept\r
+       auto try_invoke(Func&& func, task_priority prioriy = normal_priority) -> decltype(func()) // noexcept\r
        {\r
                if(boost::this_thread::get_id() == thread_.get_id())  // Avoids potential deadlock.\r
                        return func();\r
index a8e91619c2cc2e50419d3980d0bd5ce988e7c386..1a8c19bbd43d8d65fd7f146fa9d426f078f42a8c 100644 (file)
@@ -29,6 +29,8 @@
 #include <string>\r
 #include <vector>\r
 \r
+static const size_t CONSUMER_BUFFER_DEPTH = 7;\r
+\r
 namespace caspar { namespace core {\r
        \r
 class read_frame;\r
index 3cb0ecaa442e46844d74bb1cf942ee4b1f8b5f4a..59cbce4110d1ab16c06a9400036ae7724972bd06 100644 (file)
@@ -48,8 +48,6 @@ struct frame_consumer_device::implementation
        \r
        video_channel_context& channel_;\r
 \r
-       boost::circular_buffer<fill_and_key> buffer_;\r
-\r
        std::map<int, safe_ptr<frame_consumer>> consumers_;\r
        typedef std::map<int, safe_ptr<frame_consumer>>::value_type layer_t;\r
        \r
@@ -87,15 +85,6 @@ public:
                        this->remove(index);\r
                        consumers_.insert(std::make_pair(index, consumer));\r
 \r
-                       auto depth = buffer_depth();\r
-                       auto diff = depth.second-depth.first+1;\r
-                       \r
-                       if(diff != buffer_.capacity())\r
-                       {\r
-                               buffer_.set_capacity(diff);\r
-                               CASPAR_LOG(info) << print() << L" Depth-diff: " << diff-1;\r
-                       }\r
-\r
                        CASPAR_LOG(info) << print() << L" " << consumer->print() << L" Added.";\r
                });\r
        }\r
@@ -113,24 +102,22 @@ public:
                });\r
        }\r
                                                \r
-       void operator()(const safe_ptr<read_frame>& frame)\r
+       void execute(const safe_ptr<read_frame>& frame)\r
        {               \r
                if(!has_synchronization_clock())\r
                        timer_.tick(1.0/channel_.get_format_desc().fps);\r
 \r
                frame_timer_.restart();\r
-                                               \r
-               buffer_.push_back(std::make_pair(frame, get_key_frame(frame)));\r
-               if(!buffer_.full())\r
-                       return;\r
-       \r
+                               \r
+               auto fill = frame;\r
+               auto key = get_key_frame(frame);\r
+\r
                for_each_consumer([&](safe_ptr<frame_consumer>& consumer)\r
                {\r
                        if(consumer->get_video_format_desc() != channel_.get_format_desc())\r
                                consumer->initialize(channel_.get_format_desc());\r
 \r
-                       auto pair = buffer_[consumer->buffer_depth()-buffer_depth().first];\r
-                       auto frame = consumer->key_only() ? pair.second : pair.first;\r
+                       auto frame = consumer->key_only() ? key : fill;\r
 \r
                        if(static_cast<size_t>(frame->image_data().size()) == consumer->get_video_format_desc().size)\r
                                consumer->send(frame);\r
@@ -200,5 +187,5 @@ frame_consumer_device::frame_consumer_device(video_channel_context& video_channe
        : impl_(new implementation(video_channel)){}\r
 void frame_consumer_device::add(int index, safe_ptr<frame_consumer>&& consumer){impl_->add(index, std::move(consumer));}\r
 void frame_consumer_device::remove(int index){impl_->remove(index);}\r
-void frame_consumer_device::operator()(const safe_ptr<read_frame>& frame) { (*impl_)(frame); }\r
+void frame_consumer_device::execute(const safe_ptr<read_frame>& frame) {impl_->execute(frame); }\r
 }}
\ No newline at end of file
index ea3a570e7e57a14a0a7460675bd347a734caf243..21a4ea9d0c7dd06a29ebadf41b3c16f00865e7e2 100644 (file)
@@ -41,7 +41,7 @@ public:
        void add(int index, safe_ptr<frame_consumer>&& consumer);\r
        void remove(int index);\r
 \r
-       void operator()(const safe_ptr<read_frame>& frame); // nothrow\r
+       void execute(const safe_ptr<read_frame>& frame); // nothrow\r
 private:\r
        struct implementation;\r
        safe_ptr<implementation> impl_;\r
index e9f80c804b38c351ea797d449e52028e4a5edefa..d9c03d61da4c435cc829667633296b5c0c2451d4 100644 (file)
@@ -117,7 +117,7 @@ public:
                CASPAR_LOG(info) << print() << L" Successfully initialized.";   \r
        }\r
                        \r
-       safe_ptr<read_frame> operator()(const std::map<int, safe_ptr<core::basic_frame>>& frames)\r
+       safe_ptr<read_frame> execute(const std::map<int, safe_ptr<core::basic_frame>>& frames)\r
        {                               \r
                frame_timer_.restart();\r
 \r
@@ -272,7 +272,7 @@ private:
 };\r
        \r
 frame_mixer_device::frame_mixer_device(video_channel_context& video_channel) : impl_(new implementation(video_channel)){}\r
-safe_ptr<core::read_frame> frame_mixer_device::operator()(const std::map<int, safe_ptr<core::basic_frame>>& frames){ return (*impl_)(frames);}\r
+safe_ptr<core::read_frame> frame_mixer_device::execute(const std::map<int, safe_ptr<core::basic_frame>>& frames){ return impl_->execute(frames);}\r
 core::video_format_desc frame_mixer_device::get_video_format_desc() const { return impl_->channel_.get_format_desc(); }\r
 safe_ptr<core::write_frame> frame_mixer_device::create_frame(void* tag, const core::pixel_format_desc& desc){ return impl_->create_frame(tag, desc); }         \r
 safe_ptr<core::write_frame> frame_mixer_device::create_frame(void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt)\r
index 2410bdf403ee2002803f31dd1d2385e41f092d73..b30b5c2ec7cbd4380aeef8d4272da3fdc90c86e7 100644 (file)
@@ -44,7 +44,7 @@ class frame_mixer_device : public core::frame_factory
 public:        \r
        explicit frame_mixer_device(video_channel_context& video_channel);\r
                \r
-       safe_ptr<core::read_frame> operator()(const std::map<int, safe_ptr<core::basic_frame>>& frames); // nothrow\r
+       safe_ptr<core::read_frame> execute(const std::map<int, safe_ptr<core::basic_frame>>& frames); // nothrow\r
                \r
        safe_ptr<core::write_frame> create_frame(void* tag, const core::pixel_format_desc& desc);               \r
        safe_ptr<core::write_frame> create_frame(void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt = core::pixel_format::bgra);          \r
index 981bf43da4a02ab67cc5a8e80c323127c2045bb8..01556f803e664a67c91a0a2eb583bf2148075ba2 100644 (file)
@@ -53,13 +53,13 @@ public:
        ~ogl_device();\r
        \r
        template<typename Func>\r
-       auto begin_invoke(Func&& func, priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
+       auto begin_invoke(Func&& func, task_priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
        {                       \r
                return executor_.begin_invoke(std::forward<Func>(func), priority);\r
        }\r
        \r
        template<typename Func>\r
-       auto invoke(Func&& func, priority priority = normal_priority) -> decltype(func())\r
+       auto invoke(Func&& func, task_priority priority = normal_priority) -> decltype(func())\r
        {\r
                return executor_.invoke(std::forward<Func>(func), priority);\r
        }\r
index ba93b77bb094651c694b5fa91aac57562bd3c0b5..6ccf9dac382af2b455f663b1a1438576e85ec171 100644 (file)
@@ -52,4 +52,16 @@ read_frame::read_frame(safe_ptr<host_buffer>&& image_data, std::vector<int16_t>&
 const boost::iterator_range<const uint8_t*> read_frame::image_data() const{return impl_->image_data();}\r
 const boost::iterator_range<const int16_t*> read_frame::audio_data() const{return impl_->audio_data();}\r
 \r
+safe_ptr<const read_frame> read_frame::empty()\r
+{\r
+       struct empty : public read_frame\r
+       {                       \r
+               virtual const boost::iterator_range<const uint8_t*> image_data() const {return boost::iterator_range<const uint8_t*>();}\r
+               virtual const boost::iterator_range<const int16_t*> audio_data() const {return boost::iterator_range<const int16_t*>();}\r
+               virtual int number() const{return -1;}\r
+       };\r
+       static safe_ptr<const empty> frame;\r
+       return frame;\r
+}\r
+\r
 }}
\ No newline at end of file
index f8231bc0635d01f19d294f93345aa99d6ac5e877..bfd9fc6f336a617debb11cb1d215b0ac0378f556 100644 (file)
@@ -42,17 +42,7 @@ public:
        virtual const boost::iterator_range<const uint8_t*> image_data() const;\r
        virtual const boost::iterator_range<const int16_t*> audio_data() const;\r
                \r
-       static safe_ptr<const read_frame> empty()\r
-       {\r
-               struct empty : public read_frame\r
-               {                       \r
-                       virtual const boost::iterator_range<const uint8_t*> image_data() const {return boost::iterator_range<const uint8_t*>();}\r
-                       virtual const boost::iterator_range<const int16_t*> audio_data() const {return boost::iterator_range<const int16_t*>();}\r
-                       virtual int number() const{return -1;}\r
-               };\r
-               static safe_ptr<const empty> frame;\r
-               return frame;\r
-       }\r
+       static safe_ptr<const read_frame> empty();\r
 private:\r
        struct implementation;\r
        std::shared_ptr<implementation> impl_;\r
index 21aa350da35944e06befba29bda664ca3523bee5..4028ddcf928aeddab940a96c4c98c07c2741d491 100644 (file)
@@ -94,7 +94,7 @@ public:
                diag_->set_color("tick-time", diagnostics::color(0.1f, 0.7f, 0.8f));    \r
        }\r
                                                \r
-       std::map<int, safe_ptr<basic_frame>> operator()()\r
+       std::map<int, safe_ptr<basic_frame>> execute()\r
        {       \r
                frame_timer_.restart();\r
                \r
@@ -216,5 +216,5 @@ void frame_producer_device::swap_layer(int index, size_t other_index){impl_->swa
 void frame_producer_device::swap_layer(int index, size_t other_index, frame_producer_device& other){impl_->swap_layer(index, other_index, other);}\r
 boost::unique_future<safe_ptr<frame_producer>> frame_producer_device::foreground(size_t index) {return impl_->foreground(index);}\r
 boost::unique_future<safe_ptr<frame_producer>> frame_producer_device::background(size_t index) {return impl_->background(index);}\r
-std::map<int, safe_ptr<basic_frame>> frame_producer_device::operator()(){return (*impl_)();}\r
+std::map<int, safe_ptr<basic_frame>> frame_producer_device::execute(){return impl_->execute();}\r
 }}
\ No newline at end of file
index 89325837e3d2d11f8c3e7a424908952b51d9b0ce..8365064857ed1e071137bede3c606656099a866e 100644 (file)
@@ -39,7 +39,7 @@ public:
 \r
        void swap(frame_producer_device& other);\r
 \r
-       std::map<int, safe_ptr<basic_frame>> operator()();\r
+       std::map<int, safe_ptr<basic_frame>> execute();\r
                \r
        void load(int index, const safe_ptr<frame_producer>& producer, bool preview = false);\r
        void pause(int index);\r
index c31a7c05da5c18b6bba3e81193f28266f02e80c9..eeb0d4323253c91176e53f974447b035b77e2faf 100644 (file)
@@ -39,7 +39,7 @@ namespace caspar { namespace core {
 \r
 struct video_channel::implementation : boost::noncopyable\r
 {\r
-       video_channel_context                                   context_;\r
+       video_channel_context                   context_;\r
 \r
        safe_ptr<frame_consumer_device> consumer_;\r
        safe_ptr<frame_mixer_device>    mixer_;\r
@@ -67,9 +67,9 @@ public:
 \r
        void tick()\r
        {\r
-               auto simple_frames = (*producer_)();\r
-               auto finished_frame = (*mixer_)(simple_frames);\r
-               (*consumer_)(finished_frame);\r
+               auto simple_frames = producer_->execute();\r
+               auto finished_frame = mixer_->execute(simple_frames);\r
+               consumer_->execute(finished_frame);\r
 \r
                context_.execution().begin_invoke([this]{tick();});\r
        }\r
index 7e0393fa0023b453b075cb40f2a5ebe139d6a4f4..7943582fe4925bdb022cea717477c9477f8de660 100644 (file)
@@ -24,7 +24,7 @@ class video_channel_context
        ogl_device&                                     ogl_;\r
 \r
 public:\r
-       video_channel_context(int index,  ogl_device& ogl, const video_format_desc& format_desc) \r
+       video_channel_context(int index, ogl_device& ogl, const video_format_desc& format_desc) \r
                : index_(index)\r
                , format_desc_(format_desc)\r
                , execution_(print() + L"/execution")\r
index cd7b8ba4088c0f850b628a3bbac076f05900de05..4fac6d84fec32f593a46dace3e7b2150095c4c56 100644 (file)
@@ -141,7 +141,7 @@ struct bluefish_consumer : boost::noncopyable
        \r
        executor executor_;\r
 public:\r
-       bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio, size_t buffer_depth\r
+       bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio) \r
                : blue_(create_blue(device_index))\r
                , device_index_(device_index)\r
                , format_desc_(format_desc) \r
@@ -155,7 +155,7 @@ public:
                , embedded_audio_(embedded_audio)\r
                , executor_(print())\r
        {\r
-               executor_.set_capacity(buffer_depth);\r
+               executor_.set_capacity(CONSUMER_BUFFER_DEPTH);\r
 \r
                graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->add_guide("tick-time", 0.5);\r
@@ -232,7 +232,6 @@ public:
 \r
        ~bluefish_consumer()\r
        {\r
-               executor_.clear();\r
                executor_.invoke([&]\r
                {\r
                        disable_video_output();\r
@@ -374,18 +373,16 @@ struct bluefish_consumer_proxy : public core::frame_consumer
        const size_t                                            device_index_;\r
        const bool                                                      embedded_audio_;\r
        bool                                                            key_only_;\r
-       size_t                                                          buffer_depth_;\r
 public:\r
 \r
-       bluefish_consumer_proxy(size_t device_index, bool embedded_audio, bool key_only, size_t buffer_depth)\r
+       bluefish_consumer_proxy(size_t device_index, bool embedded_audio, bool key_only)\r
                : device_index_(device_index)\r
                , embedded_audio_(embedded_audio)\r
-               , key_only_(key_only)\r
-               , buffer_depth_(buffer_depth){}\r
+               , key_only_(key_only){}\r
        \r
        virtual void initialize(const core::video_format_desc& format_desc)\r
        {\r
-               consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_, buffer_depth_));\r
+               consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_));\r
        }\r
        \r
        virtual void send(const safe_ptr<const core::read_frame>& frame)\r
@@ -407,11 +404,6 @@ public:
        {\r
                return key_only_;\r
        }\r
-\r
-       virtual size_t buffer_depth() const\r
-       {\r
-               return consumer_->executor_.capacity();\r
-       }\r
 };     \r
 \r
 std::wstring get_bluefish_version()\r
@@ -464,7 +456,7 @@ safe_ptr<core::frame_consumer> create_bluefish_consumer(const std::vector<std::w
        bool embedded_audio = std::find(params.begin(), params.end(), L"EMBEDDED_AUDIO") != params.end();\r
        bool key_only           = std::find(params.begin(), params.end(), L"KEY_ONLY")           != params.end();\r
 \r
-       return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only, 3);\r
+       return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
 }\r
 \r
 safe_ptr<core::frame_consumer> create_bluefish_consumer(const boost::property_tree::ptree& ptree) \r
@@ -472,9 +464,8 @@ safe_ptr<core::frame_consumer> create_bluefish_consumer(const boost::property_tr
        auto device_index        = ptree.get("device",             1);\r
        auto embedded_audio  = ptree.get("embedded-audio", false);\r
        bool key_only            = ptree.get("key-only",           false);\r
-       size_t buffer_depth  = ptree.get("buffer-depth",   3);\r
 \r
-       return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only, buffer_depth);\r
+       return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
 }\r
 \r
 }
\ No newline at end of file
index 3e41b4c5d0cb4c22393f42e8b9887bac68a6b3af..5d520af5f268e109d71aa79c660428527aa2a3cb 100644 (file)
@@ -57,7 +57,7 @@ struct configuration
                , external_key(false)\r
                , low_latency(false)\r
                , key_only(false)\r
-               , buffer_depth(5){}\r
+               , buffer_depth(CONSUMER_BUFFER_DEPTH){}\r
 };\r
 \r
 class decklink_frame_adapter : public IDeckLinkVideoFrame\r
@@ -442,7 +442,6 @@ safe_ptr<core::frame_consumer> create_decklink_consumer(const boost::property_tr
        config.key_only                 = ptree.get("key-only",           config.key_only);\r
        config.device_index             = ptree.get("device",             config.device_index);\r
        config.embedded_audio   = ptree.get("embedded-audio", config.embedded_audio);\r
-       config.buffer_depth             = ptree.get("buffer-depth",       config.buffer_depth);\r
 \r
        return make_safe<decklink_consumer_proxy>(config);\r
 }\r
index decc821a88210a00da6236466c98b614d2333496..3cc9c75625a300386b03fd39992a116b8e97c97a 100644 (file)
@@ -29,7 +29,7 @@
 \r
 namespace caspar { \r
        \r
-safe_ptr<core::frame_consumer> create_ffmpeg_consumer(const std::vector<std::wstring>& params);\r
-safe_ptr<core::frame_consumer> create_ffmpeg_consumer(const boost::property_tree::ptree& ptree);\r
+//safe_ptr<core::frame_consumer> create_ffmpeg_consumer(const std::vector<std::wstring>& params);\r
+//safe_ptr<core::frame_consumer> create_ffmpeg_consumer(const boost::property_tree::ptree& ptree);\r
 \r
 }
\ No newline at end of file
index 21490a92d500eab86a191e7e7ffa527e76ccbd3c..b4727512347988a5a4e85e466c74c8f78a855b21 100644 (file)
@@ -46,7 +46,7 @@ void init_ffmpeg()
        av_register_all();\r
        avcodec_init();\r
        \r
-       core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_ffmpeg_consumer(params);});\r
+       //core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_ffmpeg_consumer(params);});\r
        core::register_producer_factory(create_ffmpeg_producer);\r
 }\r
 \r
index 623f7065b259524b6e4f5d07224a9d7ae206bdae..5b27feb4748f7e74c9129f6ccbcbadfde4535611 100644 (file)
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
     </ClCompile>\r
     <ClCompile Include="ffmpeg.cpp" />\r
     <ClCompile Include="producer\audio\audio_decoder.cpp">\r
index 593fd71b1b588f8141a70427b9831f6ae3007a9d..cbd7a73acf1b29752254c079c54f9b99829f340a 100644 (file)
@@ -47,21 +47,19 @@ struct oal_consumer::implementation : public sf::SoundStream, boost::noncopyable
        tbb::atomic<bool> is_running_;\r
 \r
        core::video_format_desc format_desc_;\r
+       int preroll_count_;\r
 public:\r
        implementation(const core::video_format_desc& format_desc) \r
                : graph_(diagnostics::create_graph(narrow(print())))\r
                , container_(5)\r
                , format_desc_(format_desc)\r
+               , preroll_count_(0)\r
        {\r
                graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.1f, 0.7f, 0.8f));\r
                is_running_ = true;\r
-               input_.set_capacity(4);\r
-\r
-               // Fill input buffer with silence.\r
-               for(size_t n = 0; n < buffer_depth(); ++n)\r
-                       input_.push(std::vector<short>(static_cast<size_t>(48000.0f/format_desc_.fps)*2, 0)); \r
-\r
+               input_.set_capacity(CONSUMER_BUFFER_DEPTH-2);\r
+               \r
                sf::SoundStream::Initialize(2, 48000);\r
                Play();         \r
                CASPAR_LOG(info) << print() << " Sucessfully initialized.";\r
@@ -77,7 +75,13 @@ public:
        }\r
        \r
        void send(const safe_ptr<const core::read_frame>& frame)\r
-       {                               \r
+       {                       \r
+               if(preroll_count_ < input_.capacity())\r
+               {\r
+                       while(input_.try_push(std::vector<short>(static_cast<size_t>(48000.0f/format_desc_.fps)*2, 0)))\r
+                               ++preroll_count_;\r
+               }\r
+\r
                if(!frame->audio_data().empty())\r
                        input_.push(std::vector<short>(frame->audio_data().begin(), frame->audio_data().end()));        \r
                else\r
index 19ba252fdf01c7d67c85a7ac51e1e3616894397d..249ae72e33ec547332795f2feba6a2aaa544dd21 100644 (file)
@@ -110,8 +110,8 @@ struct server::implementation : boost::noncopyable
                                                channels_.back()->consumer()->add(index++, create_bluefish_consumer(xml_consumer.second));                                      \r
                                        else if(name == "decklink")                                     \r
                                                channels_.back()->consumer()->add(index++, create_decklink_consumer(xml_consumer.second));                              \r
-                                       else if(name == "file")                                 \r
-                                               channels_.back()->consumer()->add(index++, create_ffmpeg_consumer(xml_consumer.second));                                                \r
+                                       //else if(name == "file")                                       \r
+                                       //      channels_.back()->consumer()->add(index++, create_ffmpeg_consumer(xml_consumer.second));                                                \r
                                        else if(name == "audio")\r
                                                channels_.back()->consumer()->add(index++, make_safe<oal_consumer>());          \r
                                        else if(name != "<xmlcomment>")\r