| 1431 | } |
| 1432 | |
| 1433 | int RtmpStreamBase::SendAVCMessage(const RtmpAVCMessage& msg) { |
| 1434 | if (_rtmpsock == NULL) { |
| 1435 | errno = EPERM; |
| 1436 | return -1; |
| 1437 | } |
| 1438 | if (_chunk_stream_id == 0) { |
| 1439 | LOG(ERROR) << __FUNCTION__ << " can't be called before play() is received"; |
| 1440 | errno = EPERM; |
| 1441 | return -1; |
| 1442 | } |
| 1443 | if (!policy::is_video_frame_type_valid(msg.frame_type)) { |
| 1444 | LOG(WARNING) << "Invalid frame_type=" << (int)msg.frame_type; |
| 1445 | } |
| 1446 | if (_paused) { |
| 1447 | errno = EPERM; |
| 1448 | return -1; |
| 1449 | } |
| 1450 | SocketMessagePtr<policy::RtmpUnsentMessage> msg2(new policy::RtmpUnsentMessage); |
| 1451 | msg2->header.timestamp = msg.timestamp; |
| 1452 | msg2->header.message_length = msg.size(); |
| 1453 | msg2->header.message_type = policy::RTMP_MESSAGE_VIDEO; |
| 1454 | msg2->header.stream_id = _message_stream_id; |
| 1455 | msg2->chunk_stream_id = _chunk_stream_id; |
| 1456 | // Make video header |
| 1457 | char avc_head[5]; |
| 1458 | char* p = avc_head; |
| 1459 | *p++ = ((msg.frame_type & 0xF) << 4) | (FLV_VIDEO_AVC & 0xF); |
| 1460 | *p++ = (FlvAVCPacketType)msg.packet_type; |
| 1461 | policy::WriteBigEndian3Bytes(&p, msg.composition_time); |
| 1462 | msg2->body.append(avc_head, sizeof(avc_head)); |
| 1463 | msg2->body.append(msg.data); |
| 1464 | return _rtmpsock->Write(msg2); |
| 1465 | } |
| 1466 | |
| 1467 | int RtmpStreamBase::SendStopMessage(const butil::StringPiece&) { |
| 1468 | return -1; |
nothing calls this directly
no test coverage detected