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

Method Write

src/brpc/rtmp.cpp:70–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70butil::Status FlvWriter::Write(const RtmpVideoMessage& msg) {
71 char buf[32];
72 char* p = buf;
73 if (!_write_header) {
74 _write_header = true;
75 const char flags_bit = static_cast<char>(_options.flv_content_type);
76 const char header[9] = { 'F', 'L', 'V', 0x01, flags_bit, 0, 0, 0, 0x09 };
77 memcpy(p, header, sizeof(header));
78 p += sizeof(header);
79 policy::WriteBigEndian4Bytes(&p, 0); // PreviousTagSize0
80 }
81 // FLV tag
82 *p++ = FLV_TAG_VIDEO;
83 policy::WriteBigEndian3Bytes(&p, msg.size());
84 policy::WriteBigEndian3Bytes(&p, (msg.timestamp & 0xFFFFFF));
85 *p++ = (msg.timestamp >> 24) & 0xFF;
86 policy::WriteBigEndian3Bytes(&p, 0); // StreamID
87 // header of VIDEODATA
88 *p++ = ((msg.frame_type & 0xF) << 4) | (msg.codec & 0xF);
89 _buf->append(buf, p - buf);
90 _buf->append(msg.data);
91 // PreviousTagSize
92 p = buf;
93 policy::WriteBigEndian4Bytes(&p, 11 + msg.size());
94 _buf->append(buf, p - buf);
95 return butil::Status::OK();
96}
97
98butil::Status FlvWriter::Write(const RtmpAudioMessage& msg) {
99 char buf[32];

Callers 7

SendMessageMethod · 0.45
SendControlMessageMethod · 0.45
SendAudioMessageMethod · 0.45
SendAACMessageMethod · 0.45
SendVideoMessageMethod · 0.45
SendAVCMessageMethod · 0.45
PlayMethod · 0.45

Calls 8

WriteBigEndian4BytesFunction · 0.85
WriteBigEndian3BytesFunction · 0.85
WriteAMFStringFunction · 0.85
WriteAMFObjectFunction · 0.85
StatusEnum · 0.70
sizeMethod · 0.45
appendMethod · 0.45
goodMethod · 0.45

Tested by

no test coverage detected