]> git.sesse.net Git - casparcg/commitdiff
2.1.0: Fixed SEEK again.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 26 Mar 2012 22:14:39 +0000 (22:14 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 26 Mar 2012 22:14:39 +0000 (22:14 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2759 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/executor.h
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/input/input.cpp
shell/casparcg.config

index 959a3ee936da9904f570412ceee813f296ff3404..33cbddb8b5e655ecc3289f853ecc2cd58156e1a0 100644 (file)
@@ -117,7 +117,7 @@ public:
        template<typename Func>\r
        auto begin_invoke(Func&& func, task_priority priority = task_priority::normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
        {       \r
-               if(execution_queue_.size() > 128)\r
+               if(execution_queue_.size() > 512)\r
                        CASPAR_THROW_EXCEPTION(invalid_operation() << msg_info("executor overflow.") << source_info(name_));\r
 \r
                if(!is_running_)\r
index e2eca62b62ec3541415050c8027c789206fb68c3..1ce19128921c887c4a4141a9ebc3bf6e364963f0 100644 (file)
@@ -351,12 +351,13 @@ public:
                // TODO: Fix HACK.\r
                \r
                target = std::min(target, file_nb_frames());\r
+               target = std::max<uint32_t>(target, 2) - 2;\r
 \r
                input_.seek(target);\r
                muxer_.clear();\r
                \r
                // BEGIN HACK: There is no way to flush yadif. Need to poll 2 frames.\r
-               for(int n = 0; n < 25 && file_frame_number() != target+3; ++n)\r
+               for(int n = 0; n < 25 && file_frame_number() != target+2; ++n)\r
                {\r
                        decode_next_frame();\r
                        if(!muxer_.empty())\r
index a4f0189706534f77ec7fbce46243391f2cc9b75e..d4b720eac8e4a9e4095ea896c1917cdd336ef6a0 100644 (file)
@@ -113,14 +113,14 @@ struct input::impl : boost::noncopyable
        tbb::atomic<uint32_t>                                                                           start_;         \r
        tbb::atomic<uint32_t>                                                                           length_;\r
        tbb::atomic<bool>                                                                                       loop_;\r
-       bool                                                                                                            eof_;\r
+       tbb::atomic<bool>                                                                                       eof_;\r
        double                                                                                                          fps_;\r
        uint32_t                                                                                                        frame_number_;\r
        \r
        stream                                                                                                          video_stream_;\r
        stream                                                                                                          audio_stream_;\r
 \r
-       uint32_t                                                                                                        seek_target_;\r
+       tbb::atomic<uint32_t>                                                                           seek_target_;\r
 \r
        tbb::atomic<bool>                                                                                       is_running_;\r
        boost::mutex                                                                                            mutex_;\r
@@ -132,22 +132,25 @@ struct input::impl : boost::noncopyable
                , format_context_(open_input(filename))         \r
                , default_stream_index_(av_find_default_stream_index(format_context_.get()))\r
                , filename_(filename)\r
-               , eof_(false)\r
-               , fps_(read_fps(*format_context_, 0.0))\r
                , frame_number_(0)\r
-               , seek_target_(start_)\r
+               , fps_(read_fps(*format_context_, 0.0))\r
                , video_stream_(av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0))\r
                , audio_stream_(av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_AUDIO, -1, -1, 0, 0))\r
        {               \r
                start_                  = start;\r
                length_                 = length;\r
                loop_                   = loop;\r
+               eof_                    = false;\r
+               seek_target_    = start_ != 0 ? start_ : std::numeric_limits<uint32_t>::max();\r
                is_running_             = true;\r
                thread_                 = boost::thread([this]{run();});\r
                                                                                \r
                graph_->set_color("seek", diagnostics::color(1.0f, 0.5f, 0.0f));        \r
                graph_->set_color("audio-buffer", diagnostics::color(0.7f, 0.4f, 0.4f));\r
-               graph_->set_color("video-buffer", diagnostics::color(1.0f, 1.0f, 0.0f));                        \r
+               graph_->set_color("video-buffer", diagnostics::color(1.0f, 1.0f, 0.0f));        \r
+               \r
+               while(!full())\r
+                       tick();\r
        }\r
 \r
        ~impl()\r
@@ -190,6 +193,9 @@ struct input::impl : boost::noncopyable
                        eof_ = false;\r
                }\r
 \r
+               while(!full())\r
+                       tick();\r
+\r
                cond_.notify_one();\r
        }\r
                \r
@@ -233,11 +239,9 @@ private:
 \r
        void tick()\r
        {\r
-               if(seek_target_ != std::numeric_limits<uint32_t>::max())                \r
-               {\r
-                       internal_seek(seek_target_);\r
-                       seek_target_ = std::numeric_limits<uint32_t>::max();\r
-               }\r
+               auto target = seek_target_.fetch_and_store(std::numeric_limits<uint32_t>::max());\r
+               if(target != std::numeric_limits<uint32_t>::max())                              \r
+                       internal_seek(target);\r
 \r
                auto packet = create_packet();\r
                \r
index efbe19a308709d0e399d0df16f0f6b31bd1e89a7..817e55fec7a19de278c0837eb7b0fc92dbc3b5aa 100644 (file)
@@ -13,7 +13,7 @@
   </flash>\r
   <channels>\r
     <channel>\r
-      <video-mode>PAL</video-mode>\r
+      <video-mode>NTSC</video-mode>\r
       <consumers>\r
         <screen>\r
           <device>1</device>\r