]> git.sesse.net Git - casparcg/commitdiff
2.0. consumer: Buffer depth (latency) is configurable in xml file.
authorRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 31 Jul 2011 00:15:46 +0000 (00:15 +0000)
committerRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 31 Jul 2011 00:15:46 +0000 (00:15 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1025 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/consumer/frame_consumer.cpp
core/consumer/frame_consumer.h
modules/bluefish/consumer/bluefish_consumer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/producer/audio/audio_decoder.cpp
modules/ffmpeg/producer/filter/scalable_yadif.cpp
modules/oal/consumer/oal_consumer.cpp
modules/ogl/consumer/ogl_consumer.cpp

index 479b43f774e28ee6dc8b91f13bf4f0243da3784f..4696c1f21f9fbf6b21e6f76da96f1fd9da2aa12d 100644 (file)
 \r
 #include <common/memory/safe_ptr.h>\r
 \r
+#include <common/env.h>\r
+\r
 namespace caspar { namespace core {\r
+\r
+size_t consumer_buffer_depth()\r
+{\r
+       return env::properties().get("configuration.consumers.buffer-depth", 5);\r
+}\r
        \r
 std::vector<const consumer_factory_t> g_factories;\r
 \r
index 04b30821b2be0a83ec2c9b6090c14a81f8ab4ef5..e133412d4ba2182070e1c30e1bf354341e86c9ed 100644 (file)
 #include <string>\r
 #include <vector>\r
 \r
-static const size_t CONSUMER_BUFFER_DEPTH = 6;\r
-\r
 namespace caspar { namespace core {\r
        \r
 class read_frame;\r
 struct video_format_desc;\r
 \r
+size_t consumer_buffer_depth();\r
+\r
 struct frame_consumer : boost::noncopyable\r
 {\r
        virtual ~frame_consumer() {}\r
index bd1e0063f65211e85f781596e6a5fc12970dcd14..989470a8438d26ed57e45bda0613662109e6e131 100644 (file)
@@ -75,7 +75,7 @@ public:
                , embedded_audio_(embedded_audio)\r
                , executor_(print())\r
        {\r
-               executor_.set_capacity(CONSUMER_BUFFER_DEPTH);\r
+               executor_.set_capacity(core::consumer_buffer_depth());\r
 \r
                graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->add_guide("tick-time", 0.5);\r
index 68f0ec380c6695da0f073c43dd71882539c6bdb8..fc888b42611e0fbb3dcb8dbe71e8f7b27029b00b 100644 (file)
@@ -57,7 +57,7 @@ struct configuration
                , external_key(false)\r
                , low_latency(false)\r
                , key_only(false)\r
-               , buffer_depth(CONSUMER_BUFFER_DEPTH){}\r
+               , buffer_depth(core::consumer_buffer_depth()){}\r
 };\r
 \r
 class decklink_frame_muxer : public IDeckLinkVideoFrame\r
index 4a490c964daf39fda0e220e32a96ca1cc6bed7b2..82dc849913f7cf388a290758feed5aaae2cd9ef2 100644 (file)
@@ -92,7 +92,7 @@ public:
                                << boost::errinfo_api_function("avformat_alloc_context"));\r
                }\r
 \r
-               executor_.set_capacity(CONSUMER_BUFFER_DEPTH);\r
+               executor_.set_capacity(core::consumer_buffer_depth());\r
 \r
                oc_->oformat = av_guess_format(nullptr, filename_.c_str(), nullptr);\r
                if (!oc_->oformat)\r
index 94329b7a30ab9ecc72dfaafca8c1e270caba1b0e..5b68bb558a7cabf94f1f08fe011018e466dc976c 100644 (file)
@@ -77,7 +77,7 @@ public:
                                                                                                        AV_SAMPLE_FMT_S16,                              codec_context_->sample_fmt,\r
                                                                                                        16, 10, 0, 0.8);\r
 \r
-                       CASPAR_LOG(warning) << L" Invalid audio format.";\r
+                       CASPAR_LOG(warning) << L" Invalid audio format. Resampling.";\r
 \r
                        if(resampler)\r
                                resampler_.reset(resampler, audio_resample_close);\r
index 86ab129b2dcccad8453688ff32dee642560344d7..5c256d0ceaf22b55fbad742fadd0dfd83d562ec0 100644 (file)
@@ -16,20 +16,20 @@ extern "C"
 }\r
 \r
 #include <boost/thread/once.hpp>\r
-
-typedef struct {
-    int mode;
-    int parity;
-    int frame_pending;
-    int auto_enable;
-    AVFilterBufferRef *cur;
-    AVFilterBufferRef *next;
-    AVFilterBufferRef *prev;
-    AVFilterBufferRef *out;
-    void (*filter_line)(uint8_t *dst,
-                        uint8_t *prev, uint8_t *cur, uint8_t *next,
-                        int w, int prefs, int mrefs, int parity, int mode);
-    const AVPixFmtDescriptor *csp;
+\r
+typedef struct {\r
+    int mode;\r
+    int parity;\r
+    int frame_pending;\r
+    int auto_enable;\r
+    AVFilterBufferRef *cur;\r
+    AVFilterBufferRef *next;\r
+    AVFilterBufferRef *prev;\r
+    AVFilterBufferRef *out;\r
+    void (*filter_line)(uint8_t *dst,\r
+                        uint8_t *prev, uint8_t *cur, uint8_t *next,\r
+                        int w, int prefs, int mrefs, int parity, int mode);\r
+    const AVPixFmtDescriptor *csp;\r
 } YADIFContext;\r
 \r
 struct scalable_yadif_context\r
index 2fc418acf188d60d8c6cafcd584d4c0516b1690e..645a87cb5a7c600867221d89f3cbdaded7d9a40d 100644 (file)
@@ -58,7 +58,7 @@ public:
                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(CONSUMER_BUFFER_DEPTH-2);\r
+               input_.set_capacity(core::consumer_buffer_depth()-2);\r
                \r
                sf::SoundStream::Initialize(2, 48000);\r
                Play();         \r
index c130b270125734e1248c75db8219f958f127da33..f36e4808927d283562a38bc5eaf5fc68986ac24e 100644 (file)
@@ -87,7 +87,7 @@ public:
                , screen_index_(screen_index)\r
                , format_desc_(format_desc_)\r
                , graph_(diagnostics::create_graph(narrow(print())))\r
-               , frame_buffer_(CONSUMER_BUFFER_DEPTH)\r
+               , frame_buffer_(core::consumer_buffer_depth())\r
                , executor_(print())\r
        {               \r
                graph_->add_guide("frame-time", 0.5);\r