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

Method OnAudioMessage

src/brpc/policy/rtmp_protocol.cpp:2138–2164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2136}
2137
2138bool RtmpChunkStream::OnAudioMessage(
2139 const RtmpMessageHeader& mh, butil::IOBuf* msg_body, Socket* socket) {
2140 char first_byte = 0;
2141 if (!msg_body->cut1(&first_byte)) {
2142 // pretty common, don't print logs.
2143 return false;
2144 }
2145 // TODO: execq?
2146 RtmpAudioMessage msg;
2147 msg.timestamp = mh.timestamp;
2148 msg.codec = (FlvAudioCodec)((first_byte >> 4) & 0xF);
2149 msg.rate = (FlvSoundRate)((first_byte >> 2) & 0x3);
2150 msg.bits = (FlvSoundBits)((first_byte >> 1) & 0x1);
2151 msg.type = (FlvSoundType)(first_byte & 0x1);
2152 msg_body->swap(msg.data);
2153
2154 const int vlvl = RPC_VLOG_LEVEL + 1;
2155 VLOG(vlvl) << socket->remote_side() << "[" << mh.stream_id << "] " << msg;
2156 butil::intrusive_ptr<RtmpStreamBase> stream;
2157 if (!connection_context()->FindMessageStream(mh.stream_id, &stream)) {
2158 LOG_EVERY_SECOND(WARNING) << socket->remote_side()
2159 << ": Fail to find stream_id=" << mh.stream_id;
2160 return false;
2161 }
2162 stream->CallOnAudioMessage(&msg);
2163 return true;
2164}
2165
2166bool RtmpChunkStream::OnVideoMessage(
2167 const RtmpMessageHeader& mh, butil::IOBuf* msg_body, Socket* socket) {

Callers

nothing calls this directly

Calls 5

FindMessageStreamMethod · 0.80
CallOnAudioMessageMethod · 0.80
cut1Method · 0.45
swapMethod · 0.45
remote_sideMethod · 0.45

Tested by

no test coverage detected