]> 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>
Thu, 27 Oct 2011 09:54:30 +0000 (09:54 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 27 Oct 2011 09:54:30 +0000 (09:54 +0000)
modules/ffmpeg/producer/audio/audio_decoder.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/frame_muxer.cpp
modules/ffmpeg/producer/video/video_decoder.cpp

index a8461143eb08c5d2fad8c9571c55ccbd7c03f982..e32bc00ee09e0133bfe951d5b533d6ef5f064696 100644 (file)
@@ -62,7 +62,6 @@ struct audio_decoder::implementation : public agent, boost::noncopyable
        ITarget<audio_decoder::target_element_t>&                                       target_;\r
 \r
        governor                                                                                                        governor_;\r
-       tbb::atomic<bool>                                                                                       is_running_;\r
        \r
 public:\r
        explicit implementation(audio_decoder::source_t& source, audio_decoder::target_t& target, AVFormatContext& context, const core::video_format_desc& format_desc) \r
@@ -79,14 +78,11 @@ public:
 \r
                source.link_target(&source_);\r
                \r
-               is_running_ = true;\r
                start();\r
        }\r
 \r
        ~implementation()\r
        {\r
-               is_running_ = false;\r
-               governor_.cancel();\r
                agent::wait(this);\r
        }\r
 \r
@@ -96,7 +92,7 @@ public:
 \r
                try\r
                {\r
-                       while(is_running_)\r
+                       while(true)\r
                        {               \r
                                auto ticket = governor_.acquire();\r
                                auto packet = receive(source_);\r
index 43de7e513b1b3f9978eee3683ff2270daddf865d..aaad94fa3370ba8c9c65dda2b9ce431b17168367 100644 (file)
@@ -134,6 +134,7 @@ public:
        ~ffmpeg_producer()\r
        {\r
                input_.stop();  \r
+               while(Concurrency::receive(frames_).first != core::basic_frame::eof()){}\r
        }\r
                                                \r
        virtual safe_ptr<core::basic_frame> receive(int hints)\r
index fc57eebeeaff393e1be5f53413a220c95abab3c6..483158e03142beace65a0cb9b48d1806b081354d 100644 (file)
@@ -82,7 +82,6 @@ struct frame_muxer2::implementation : public Concurrency::agent, boost::noncopya
 \r
        ~implementation()\r
        {\r
-               governor_.cancel();\r
                agent::wait(this);\r
        }\r
                                \r
@@ -161,11 +160,16 @@ struct frame_muxer2::implementation : public Concurrency::agent, boost::noncopya
                                auto ticket = governor_.acquire();\r
 \r
                                auto video = receive_video();\r
-                               video->audio_data() = std::move(*receive_audio());\r
-\r
                                if(!video)\r
                                        break;\r
 \r
+                               auto audio = receive_audio();\r
+\r
+                               if(!audio)\r
+                                       break;\r
+\r
+                               video->audio_data() = std::move(*audio);\r
+                               \r
                                switch(display_mode_.value())\r
                                {\r
                                case display_mode::simple:                      \r
index 6e16a54d00c2007313fca0da109cdb36497b7a0f..911963d9cee6d9942ae793212d59fd7802dda837 100644 (file)
@@ -66,7 +66,6 @@ struct video_decoder::implementation : public Concurrency::agent, boost::noncopy
        ITarget<video_decoder::target_element_t>&                       target_;\r
 \r
        governor                                                                                        governor_;\r
-       tbb::atomic<bool>                                                                       is_running_;\r
        \r
 public:\r
        explicit implementation(video_decoder::source_t& source, video_decoder::target_t& target, AVFormatContext& context) \r
@@ -84,14 +83,11 @@ public:
                \r
                source.link_target(&source_);\r
                \r
-               is_running_ = true;\r
                start();\r
        }\r
 \r
        ~implementation()\r
        {\r
-               is_running_ = false;\r
-               governor_.cancel();\r
                agent::wait(this);\r
        }\r
        \r
@@ -122,7 +118,7 @@ public:
 \r
                try\r
                {\r
-                       while(is_running_)\r
+                       while(true)\r
                        {\r
                                auto ticket = governor_.acquire();\r
                                auto packet = receive(source_);\r