| 1153 | } |
| 1154 | |
| 1155 | ParseResult RtmpContext::Feed(butil::IOBuf* source, Socket* socket) { |
| 1156 | switch (_state) { |
| 1157 | case STATE_UNINITIALIZED: |
| 1158 | if (socket->CreatedByConnect()) { |
| 1159 | return WaitForS0S1(source, socket); |
| 1160 | } else { |
| 1161 | return WaitForC0C1orSimpleRtmp(source, socket); |
| 1162 | } |
| 1163 | case STATE_RECEIVED_S0S1: |
| 1164 | return WaitForS2(source, socket); |
| 1165 | case STATE_RECEIVED_C0C1: |
| 1166 | return WaitForC2(source, socket); |
| 1167 | case STATE_RECEIVED_S2: |
| 1168 | case STATE_RECEIVED_C2: |
| 1169 | return OnChunks(source, socket); |
| 1170 | } |
| 1171 | CHECK(false) << "Never here!"; |
| 1172 | return MakeParseError(PARSE_ERROR_NO_RESOURCE); |
| 1173 | } |
| 1174 | |
| 1175 | ParseResult RtmpContext::WaitForC0C1orSimpleRtmp(butil::IOBuf* source, Socket* socket) { |
| 1176 | if (source->length() < RTMP_HANDSHAKE_SIZE0 + MAGIC_NUMBER_SIZE) { |
no test coverage detected