| 1260 | } |
| 1261 | |
| 1262 | int RtmpStreamBase::SendMessage(uint32_t timestamp, |
| 1263 | uint8_t message_type, |
| 1264 | const butil::IOBuf& body) { |
| 1265 | if (_rtmpsock == NULL) { |
| 1266 | errno = EPERM; |
| 1267 | return -1; |
| 1268 | } |
| 1269 | if (_chunk_stream_id == 0) { |
| 1270 | LOG(ERROR) << "SendXXXMessage can't be called before play() is received"; |
| 1271 | errno = EPERM; |
| 1272 | return -1; |
| 1273 | } |
| 1274 | SocketMessagePtr<policy::RtmpUnsentMessage> msg(new policy::RtmpUnsentMessage); |
| 1275 | msg->header.timestamp = timestamp; |
| 1276 | msg->header.message_length = body.size(); |
| 1277 | msg->header.message_type = message_type; |
| 1278 | msg->header.stream_id = _message_stream_id; |
| 1279 | msg->chunk_stream_id = _chunk_stream_id; |
| 1280 | msg->body = body; |
| 1281 | return _rtmpsock->Write(msg); |
| 1282 | } |
| 1283 | |
| 1284 | int RtmpStreamBase::SendControlMessage( |
| 1285 | uint8_t message_type, const void* body, size_t size) { |