static int mms_safe_send_recv(MMSTContext *mmst, int (*send_fun)(MMSTContext *mmst), const MMSSCPacketType expect_type) { MMSSCPacketType type; if(send_fun) { int ret = send_fun(mmst); if (ret < 0) { av_dlog(NULL, "Send Packet error before expecting recv packet %d\n", expect_type); return ret; } } if ((type = get_tcp_server_response(mmst)) != expect_type) { av_log(NULL, AV_LOG_ERROR, "Corrupt stream (unexpected packet type 0x%x, expected 0x%x)\n", type, expect_type); return AVERROR_INVALIDDATA; } else { return 0; } }
static int mms_safe_send_recv(MMSContext *mms, int (*send_fun)(MMSContext *mms), const MMSSCPacketType expect_type) { MMSSCPacketType type; if(send_fun) { int ret = send_fun(mms); if (ret < 0) { dprintf(NULL, "Send Packet error before expecting recv packet %d\n", expect_type); return ret; } } if ((type = get_tcp_server_response(mms)) != expect_type) { dprintf(NULL,"Unexpected packet type %d with type %d\n", type, expect_type); return -1; } else { return 0; } }