| 39 | } |
| 40 | |
| 41 | EncoderThread::EncoderThread(const std::shared_ptr<RdApplication>& app) { |
| 42 | app_ = app; |
| 43 | stat_ = RdStatistics::Instance(); |
| 44 | context_ = app->GetContext(); |
| 45 | settings_ = RdSettings::Instance(); |
| 46 | plugin_manager_ = context_->GetPluginManager(); |
| 47 | enc_thread_ = Thread::Make("encoder_thread", 5); |
| 48 | enc_thread_->Poll(); |
| 49 | |
| 50 | // frame carrier |
| 51 | frame_carrier_plugin_ = plugin_manager_->GetFrameCarrierPlugin(); |
| 52 | |
| 53 | msg_listener_ = context_->CreateMessageListener(); |
| 54 | msg_listener_->Listen<MsgInsertKeyFrame>([=, this](const MsgInsertKeyFrame& msg) { |
| 55 | // plugins: InsertIdr |
| 56 | plugin_manager_->VisitEncoderPlugins([=](GrVideoEncoderPlugin* plugin) { |
| 57 | plugin->InsertIdr(); |
| 58 | }); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | void EncoderThread::Encode(const CaptureVideoFrame& cap_video_msg) { |
| 63 | if (!frame_carrier_plugin_) { |
nothing calls this directly
no test coverage detected