#include <common/env.h>\r
\r
#include <tbb/parallel_invoke.h>\r
+#include <tbb/task_group.h>\r
\r
#include <boost/timer.hpp>\r
#include <boost/range/algorithm.hpp>\r
\r
std::deque<std::pair<int, std::vector<int16_t>>> audio_chunks_;\r
std::deque<std::pair<int, safe_ptr<core::write_frame>>> video_frames_;\r
+ \r
+ tbb::task_group task_group_;\r
public:\r
explicit ffmpeg_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, const std::wstring& filter_str, bool loop, int start, int length) \r
: filename_(filename)\r
}\r
\r
safe_ptr<core::basic_frame> decode_frame()\r
- {\r
- decode_packets();\r
+ { \r
+ // "receive" is called on the same thread as the gpu mixer runs. Minimize "receive" time in order to allow gpu and cpu to run in parallel. \r
+ task_group_.wait();\r
+ task_group_.run([=]\r
+ {\r
+ decode_packets();\r
+ });\r
\r
if(video_decoder_ && audio_decoder_ && !video_frames_.empty() && !audio_chunks_.empty())\r
{\r