12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #pragma once
- #include<mutex>
- #include<memory>
- #include<string>
- #include<condition_variable>
- #include <vector>
-
-
-
- class CRemoteWindow;
-
- struct Message
- {
- int32_t cmd;
- int32_t index;
- int64_t param_l;
- int64_t param_r;
-
- };
- class IRender;
- class CIOBuffer;
- class CRemoteCtrl;
- class SocketRemote;
- class CMessageQueue
- {
- public:
- CMessageQueue(CRemoteCtrl* c);
- ~CMessageQueue();
- void Start(EgoType type,std::array<IRender*, RenderPosition::ALL>& ar);
-
- void Stop();
- void PostMessage(int32_t cmd, int32_t index, int64_t l = 0, int64_t r = 0);
- void Process(CIOBuffer * pBuffer);
- void KeepAlive(bool balive);
- SocketRemote* GetRemoteClient();
- void OnConnect(int32_t peer);
- void NotifyLeave();
- void NotifyReq(int32_t peer, int32_t index);
- void OverlayVideo(RenderPosition pos, const webrtc::VideoFrame& frame);
- private:
- void EnQueue(CIOBuffer* pBuffer);
- void Run();
- void OnIdle();
- private:
- std::mutex _lock;
- std::condition_variable _cv;
- CIOBuffer* _head;
- CIOBuffer* _tail;
- std::thread _thread;
- bool _run;
- std::vector<std::unique_ptr<CRemoteWindow>> _WindowArray;
- CRemoteCtrl* _ctrl;
- bool _alive = false;
- int32_t _peer = -1;
-
-
- };
|