MCPcopy Create free account
hub / github.com/PHZ76/RtspServer / snedFrameThread

Function snedFrameThread

example/rtsp_pusher.cpp:43–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void snedFrameThread(xop::RtspPusher* rtsp_pusher)
44{
45 while(rtsp_pusher->IsConnected())
46 {
47 {
48 /*
49 //获取一帧 H264, 打包
50 xop::AVFrame videoFrame = {0};
51 //videoFrame.size = video frame size; // 视频帧大小
52 videoFrame.timestamp = xop::H264Source::GetTimestamp(); // 时间戳, 建议使用编码器提供的时间戳
53 videoFrame.buffer.reset(new uint8_t[videoFrame.size]);
54 //memcpy(videoFrame.buffer.get(), video frame data, videoFrame.size);
55
56 rtsp_pusher->PushFrame(xop::channel_0, videoFrame); //推流到服务器, 接口线程安全
57 */
58 }
59
60 {
61 /*
62 //获取一帧 AAC, 打包
63 xop::AVFrame audioFrame = {0};
64 //audioFrame.size = audio frame size; // 音频帧大小
65 audioFrame.timestamp = xop::AACSource::GetTimestamp(44100); // 时间戳
66 audioFrame.buffer.reset(new uint8_t[audioFrame.size]);
67 //memcpy(audioFrame.buffer.get(), audio frame data, audioFrame.size);
68
69 rtsp_pusher->PushFrame(xop::channel_1, audioFrame); //推流到服务器, 接口线程安全
70 */
71 }
72
73 xop::Timer::Sleep(1);
74 }
75}

Callers

nothing calls this directly

Calls 1

IsConnectedMethod · 0.80

Tested by

no test coverage detected