| 39 | } |
| 40 | |
| 41 | void PluginEventRouter::ProcessPluginEvent(const std::shared_ptr<GrPluginBaseEvent>& event) { |
| 42 | // encoded video frame |
| 43 | if (event->event_type_ == GrPluginEventType::kPluginEncodedVideoFrameEvent) { |
| 44 | auto target_event = std::dynamic_pointer_cast<GrPluginEncodedVideoFrameEvent>(event); |
| 45 | stream_event_router_->ProcessEncodedVideoFrameEvent(target_event); |
| 46 | } |
| 47 | else if (event->event_type_ == GrPluginEventType::kPluginNetClientEvent) { |
| 48 | auto target_event = std::dynamic_pointer_cast<GrPluginNetClientEvent>(event); |
| 49 | net_event_router_->ProcessNetEvent(target_event); |
| 50 | } |
| 51 | else if (event->event_type_ == GrPluginEventType::kPluginClientConnectedEvent) { |
| 52 | auto target_event = std::dynamic_pointer_cast<GrPluginClientConnectedEvent>(event); |
| 53 | net_event_router_->ProcessClientConnectedEvent(target_event); |
| 54 | } |
| 55 | else if (event->event_type_ == GrPluginEventType::kPluginClientDisConnectedEvent) { |
| 56 | auto target_event = std::dynamic_pointer_cast<GrPluginClientDisConnectedEvent>(event); |
| 57 | net_event_router_->ProcessClientDisConnectedEvent(target_event); |
| 58 | } |
| 59 | else if (event->event_type_ == GrPluginEventType::kPluginCapturedVideoFrameEvent) { |
| 60 | auto target_event = std::dynamic_pointer_cast<GrPluginCapturedVideoFrameEvent>(event); |
| 61 | msg_notifier_->SendAppMessage(target_event->frame_); |
| 62 | } |
| 63 | else if (event->event_type_ == GrPluginEventType::kPluginCapturingMonitorInfoEvent) { |
| 64 | auto target_event = std::dynamic_pointer_cast<GrPluginCapturingMonitorInfoEvent>(event); |
| 65 | net_event_router_->ProcessCapturingMonitorInfoEvent(target_event); |
| 66 | } |
| 67 | else if (event->event_type_ == GrPluginEventType::kPluginCursorEvent) { |
| 68 | auto target_event = std::dynamic_pointer_cast<GrPluginCursorEvent>(event); |
| 69 | msg_notifier_->SendAppMessage(target_event->cursor_info_); |
| 70 | } |
| 71 | else if (event->event_type_ == GrPluginEventType::kPluginRawVideoFrameEvent) { |
| 72 | auto target_event = std::dynamic_pointer_cast<GrPluginRawVideoFrameEvent>(event); |
| 73 | auto msg = CaptureVideoFrame{}; |
| 74 | msg.frame_width_ = target_event->image_->width; |
| 75 | msg.frame_height_ = target_event->image_->height; |
| 76 | msg.frame_index_ = target_event->frame_index_; |
| 77 | msg.raw_image_ = target_event->image_; |
| 78 | msg.adapter_uid_ = -1; |
| 79 | msg.frame_format_ = target_event->frame_format_; |
| 80 | msg_notifier_->SendAppMessage(msg); |
| 81 | } |
| 82 | else if (event->event_type_ == GrPluginEventType::kPluginRawAudioFrameEvent) { |
| 83 | auto target_event = std::dynamic_pointer_cast<GrPluginRawAudioFrameEvent>(event); |
| 84 | auto msg = CaptureAudioFrame{}; |
| 85 | msg.samples_ = target_event->sample_rate_; |
| 86 | msg.channels_ = target_event->channels_; |
| 87 | msg.bits_ = target_event->bits_; |
| 88 | msg.full_data_ = target_event->full_data_; |
| 89 | msg_notifier_->SendAppMessage(msg); |
| 90 | } |
| 91 | else if (event->event_type_ == GrPluginEventType::kPluginSplitRawAudioFrameEvent) { |
| 92 | auto target_event = std::dynamic_pointer_cast<GrPluginSplitRawAudioFrameEvent>(event); |
| 93 | auto msg = CaptureAudioFrame{}; |
| 94 | msg.samples_ = target_event->sample_rate_; |
| 95 | msg.channels_ = target_event->channels_; |
| 96 | msg.bits_ = target_event->bits_; |
| 97 | msg.left_ch_data_ = target_event->left_ch_data_; |
| 98 | msg.right_ch_data_ = target_event->right_ch_data_; |
no test coverage detected