MCPcopy Create free account
hub / github.com/apache/brpc / SendData

Method SendData

test/brpc_rtmp_unittest.cpp:210–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208};
209
210void PlayingDummyStream::SendData() {
211 LOG(INFO) << "Enter SendData of PlayingDummyStream=" << this;
212
213 brpc::RtmpVideoMessage vmsg;
214 brpc::RtmpAudioMessage amsg;
215
216 vmsg.timestamp = 1000;
217 amsg.timestamp = 1000;
218 for (int i = 0; !bthread_stopped(bthread_self()); ++i) {
219 vmsg.timestamp += 20;
220 amsg.timestamp += 20;
221
222 vmsg.frame_type = brpc::FLV_VIDEO_FRAME_KEYFRAME;
223 vmsg.codec = brpc::FLV_VIDEO_AVC;
224 vmsg.data.clear();
225 vmsg.data.append(butil::string_printf("video_%d(ms_id=%u)",
226 i, stream_id()));
227 //failing to send is possible
228 SendVideoMessage(vmsg);
229
230 amsg.codec = brpc::FLV_AUDIO_AAC;
231 amsg.rate = brpc::FLV_SOUND_RATE_44100HZ;
232 amsg.bits = brpc::FLV_SOUND_16BIT;
233 amsg.type = brpc::FLV_SOUND_STEREO;
234 amsg.data.clear();
235 amsg.data.append(butil::string_printf("audio_%d(ms_id=%u)",
236 i, stream_id()));
237 SendAudioMessage(amsg);
238
239 bthread_usleep(1000000);
240 }
241
242 LOG(INFO) << "Quit SendData of PlayingDummyStream=" << this;
243}
244
245class PlayingDummyService : public brpc::RtmpService {
246public:

Callers 1

RunSendDataMethod · 0.80

Calls 6

bthread_stoppedFunction · 0.85
bthread_selfFunction · 0.85
string_printfFunction · 0.85
bthread_usleepFunction · 0.85
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected