]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 9 Mar 2012 22:19:22 +0000 (22:19 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 9 Mar 2012 22:19:22 +0000 (22:19 +0000)
accelerator/ogl/util/buffer.cpp
common/log.cpp
common/log.h
modules/ffmpeg/producer/util/util.cpp
protocol/cii/CIIProtocolStrategy.cpp

index 2c401b2a45b3f65e9fe666ca27df29132132de6e..702ad0c1cab57849fdf25ea416efbb7c251b2213 100644 (file)
@@ -80,7 +80,13 @@ public:
                if(usage_ == GL_STREAM_DRAW)                    \r
                        GL(glBufferData(target_, size_, NULL, usage_)); // Notify OpenGL that we don't care about previous data.\r
                \r
+               boost::timer timer;\r
+\r
                data_ = (uint8_t*)GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY));  \r
+\r
+               if(timer.elapsed() > 0.01)\r
+                       CASPAR_LOG(warning) << L"[buffer] Performance warning. Buffer mapping blocked more than 10ms.";\r
+\r
                GL(glBindBuffer(target_, 0));\r
                if(!data_)\r
                        BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Failed to map target OpenGL Pixel Buffer Object."));\r
index 6517aeb1efd66374eba3fdd8a64776a1a90effbd..084cd4ca8f72ba347dc1b264cdb3495766c853b6 100644 (file)
@@ -69,6 +69,20 @@ namespace caspar { namespace log {
 \r
 using namespace boost;\r
 \r
+template<typename T>\r
+inline void replace_nonprintable(std::basic_string<T, std::char_traits<T>, std::allocator<T>>& str, T with)\r
+{\r
+       std::locale loc;\r
+       std::replace_if(str.begin(), str.end(), [&](T c)->bool { return !std::isprint(c, loc) && c != '\r' && c != '\n'; }, with);\r
+}\r
+\r
+template<typename T>\r
+inline std::basic_string<T> replace_nonprintable_copy(std::basic_string<T, std::char_traits<T>, std::allocator<T>> str, T with)\r
+{\r
+       replace_nonprintable(str, with);\r
+       return str;\r
+}\r
+\r
 void my_formatter(std::wostream& strm, boost::log::basic_record<wchar_t> const& rec)\r
 {\r
     namespace lambda = boost::lambda;\r
@@ -85,8 +99,7 @@ void my_formatter(std::wostream& strm, boost::log::basic_record<wchar_t> const&
     boost::log::attributes::current_thread_id::held_type thread_id;\r
     if(boost::log::extract<boost::log::attributes::current_thread_id::held_type>(L"ThreadID", rec.attribute_values(), lambda::var(thread_id) = lambda::_1))\r
         strm << L"[" << thread_id << L"] ";\r
-\r
-\r
+       \r
     severity_level severity;\r
     if(boost::log::extract<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get(), rec.attribute_values(), lambda::var(severity) = lambda::_1))\r
        {\r
index 859da6bf299cc2df10259827723b027d895ade94..fe66e2e7498ea400a3fce5fb14cd52dc7386acc0 100644 (file)
@@ -98,20 +98,6 @@ BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
 \r
 void set_log_level(const std::wstring& lvl);\r
 \r
-template<typename T>\r
-inline void replace_nonprintable(std::basic_string<T, std::char_traits<T>, std::allocator<T>>& str, T with)\r
-{\r
-       std::locale loc;\r
-       std::replace_if(str.begin(), str.end(), [&](T c)->bool { return !std::isprint(c, loc) && c != '\r' && c != '\n'; }, with);\r
-}\r
-\r
-template<typename T>\r
-inline std::basic_string<T> replace_nonprintable_copy(std::basic_string<T, std::char_traits<T>, std::allocator<T>> str, T with)\r
-{\r
-       replace_nonprintable(str, with);\r
-       return str;\r
-}\r
-\r
 }}\r
 \r
 #if defined(_MSC_VER)\r
index 36b0686086b2538f508c234e2314b57a92a93c12..26041bf8bc25196c5e7b2c8529989e24803bf863 100644 (file)
@@ -507,15 +507,13 @@ std::wstring print_mode(int width, int height, double fps, bool interlaced)
 }\r
 \r
 bool is_valid_file(const std::wstring filename)\r
-{                      \r
-       {\r
-               static auto exts = boost::assign::list_of(L".m2t")(L".mov")(L".mp4")(L".dv")(L".flv")(L".mpg")(L".wav")(L".mp3")(L".dnxhd")(L".h264")(L".prores");\r
+{                              \r
+       static std::vector<std::wstring> exts = boost::assign::list_of(L".m2t")(L".mov")(L".mp4")(L".dv")(L".flv")(L".mpg")(L".wav")(L".mp3")(L".dnxhd")(L".h264")(L".prores");\r
 \r
-               auto ext = boost::to_lower_copy(boost::filesystem::path(filename).extension().wstring());\r
+       auto ext = boost::to_lower_copy(boost::filesystem::path(filename).extension().wstring());\r
                \r
-               if(std::find(exts.begin(), exts.end(), ext) != exts.end())\r
-                       return true;\r
-       }\r
+       if(std::find(exts.begin(), exts.end(), ext) != exts.end())\r
+               return true;    \r
        \r
        auto u8filename = u8(filename);\r
        \r
index 691dd371662d694d6238ac8f7a642ae8092b663f..bf312cb16b710642ef52609aa6aea3377a238244 100644 (file)
@@ -85,7 +85,7 @@ void CIIProtocolStrategy::Parse(const TCHAR* pData, int charCount, IO::ClientInf
 \r
 void CIIProtocolStrategy::ProcessMessage(const std::wstring& message, IO::ClientInfoPtr pClientInfo)\r
 {      \r
-       CASPAR_LOG(info) << L"Received message from " << pClientInfo->print() << ": " << log::replace_nonprintable_copy(message, L'?') + L"\\r\\n";\r
+       CASPAR_LOG(info) << L"Received message from " << pClientInfo->print() << ": " << message + L"\\r\\n";\r
 \r
        std::vector<std::wstring> tokens;\r
        int tokenCount = TokenizeMessage(message, &tokens);\r