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

Method SendAACMessage

src/brpc/rtmp.cpp:1363–1393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1361}
1362
1363int RtmpStreamBase::SendAACMessage(const RtmpAACMessage& msg) {
1364 if (_rtmpsock == NULL) {
1365 errno = EPERM;
1366 return -1;
1367 }
1368 if (_chunk_stream_id == 0) {
1369 LOG(ERROR) << __FUNCTION__ << " can't be called before play() is received";
1370 errno = EPERM;
1371 return -1;
1372 }
1373 if (_paused) {
1374 errno = EPERM;
1375 return -1;
1376 }
1377 SocketMessagePtr<policy::RtmpUnsentMessage> msg2(new policy::RtmpUnsentMessage);
1378 msg2->header.timestamp = msg.timestamp;
1379 msg2->header.message_length = msg.size();
1380 msg2->header.message_type = policy::RTMP_MESSAGE_AUDIO;
1381 msg2->header.stream_id = _message_stream_id;
1382 msg2->chunk_stream_id = _chunk_stream_id;
1383 // Make audio header.
1384 char aac_head[2];
1385 aac_head[0] = ((FLV_AUDIO_AAC & 0xF) << 4)
1386 | ((msg.rate & 0x3) << 2)
1387 | ((msg.bits & 0x1) << 1)
1388 | (msg.type & 0x1);
1389 aac_head[1] = (FlvAACPacketType)msg.packet_type;
1390 msg2->body.append(aac_head, sizeof(aac_head));
1391 msg2->body.append(msg.data);
1392 return _rtmpsock->Write(msg2);
1393}
1394
1395int RtmpStreamBase::SendUserMessage(void*) {
1396 CHECK(false) << "You should implement your own SendUserMessage";

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
appendMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected