| 55 | } |
| 56 | |
| 57 | void SendFrameThread(xop::RtspServer* rtsp_server, xop::MediaSessionId session_id, int& clients) |
| 58 | { |
| 59 | while(1) |
| 60 | { |
| 61 | if(clients > 0) /* 会话有客户端在线, 发送音视频数据 */ |
| 62 | { |
| 63 | { |
| 64 | /* |
| 65 | //获取一帧 H264, 打包 |
| 66 | xop::AVFrame videoFrame = {0}; |
| 67 | videoFrame.type = 0; // 建议确定帧类型。I帧(xop::VIDEO_FRAME_I) P帧(xop::VIDEO_FRAME_P) |
| 68 | videoFrame.size = video frame size; // 视频帧大小 |
| 69 | videoFrame.timestamp = xop::H264Source::GetTimestamp(); // 时间戳, 建议使用编码器提供的时间戳 |
| 70 | videoFrame.buffer.reset(new uint8_t[videoFrame.size]); |
| 71 | memcpy(videoFrame.buffer.get(), video frame data, videoFrame.size); |
| 72 | |
| 73 | rtsp_server->PushFrame(session_id, xop::channel_0, videoFrame); //送到服务器进行转发, 接口线程安全 |
| 74 | */ |
| 75 | } |
| 76 | |
| 77 | { |
| 78 | /* |
| 79 | //获取一帧 AAC, 打包 |
| 80 | xop::AVFrame audioFrame = {0}; |
| 81 | audioFrame.type = xop::AUDIO_FRAME; |
| 82 | audioFrame.size = audio frame size; /* 音频帧大小 |
| 83 | audioFrame.timestamp = xop::AACSource::GetTimestamp(44100); // 时间戳 |
| 84 | audioFrame.buffer.reset(new uint8_t[audioFrame.size]); |
| 85 | memcpy(audioFrame.buffer.get(), audio frame data, audioFrame.size); |
| 86 | |
| 87 | rtsp_server->PushFrame(session_id, xop::channel_1, audioFrame); // 送到服务器进行转发, 接口线程安全 |
| 88 | */ |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | xop::Timer::Sleep(1); /* 实际使用需要根据帧率计算延时! */ |
| 93 | } |
| 94 | } |
nothing calls this directly
no outgoing calls
no test coverage detected