| 2469 | } |
| 2470 | |
| 2471 | bool RtmpChunkStream::OnResult(const RtmpMessageHeader& mh, |
| 2472 | AMFInputStream* istream, Socket* socket) { |
| 2473 | uint32_t transaction_id = 0; |
| 2474 | if (!ReadAMFUint32(&transaction_id, istream)) { |
| 2475 | RTMP_ERROR(socket, mh) << "Fail to read _result.TransactionId"; |
| 2476 | return false; |
| 2477 | } |
| 2478 | if (transaction_id < 2) { |
| 2479 | if (transaction_id == 1) { |
| 2480 | RtmpConnectResponse connect_res; |
| 2481 | if (!ReadAMFObject(&connect_res, istream)) { |
| 2482 | RTMP_ERROR(socket, mh) << "Fail to read _result.Properties"; |
| 2483 | return false; |
| 2484 | } |
| 2485 | if (!_conn_ctx->_simplified_rtmp) { |
| 2486 | // In simplified rtmp case, connection_context()->_create_stream_with_play_or_publish |
| 2487 | // is set and OnConnected is called in RtmpConnect::StartConnect, so we don't need |
| 2488 | // to do these operations again here. |
| 2489 | if (connect_res.create_stream_with_play_or_publish()) { |
| 2490 | connection_context()->_create_stream_with_play_or_publish = true; |
| 2491 | } |
| 2492 | connection_context()->OnConnected(0); |
| 2493 | } else { |
| 2494 | CHECK(connect_res.create_stream_with_play_or_publish()); |
| 2495 | } |
| 2496 | } // else nothing to do with transaction_id=0 |
| 2497 | return true; |
| 2498 | } |
| 2499 | if (connection_context()->unconnected()) { |
| 2500 | RTMP_ERROR(socket, mh) << "Received _result.TransactionId=" |
| 2501 | << transaction_id << " before connected"; |
| 2502 | } |
| 2503 | RtmpContext* ctx = static_cast<RtmpContext*>(socket->parsing_context()); |
| 2504 | RtmpTransactionHandler* handler = ctx->RemoveTransaction(transaction_id); |
| 2505 | if (handler == NULL) { |
| 2506 | RTMP_WARNING(socket, mh) << "Unknown _result.TransactionId=" |
| 2507 | << transaction_id; |
| 2508 | return false; |
| 2509 | } |
| 2510 | // TODO: Should Run return bool? |
| 2511 | handler->Run(false, mh, istream, socket); |
| 2512 | return true; |
| 2513 | } |
| 2514 | |
| 2515 | bool RtmpChunkStream::OnError(const RtmpMessageHeader& mh, |
| 2516 | AMFInputStream* istream, |
nothing calls this directly
no test coverage detected